Menggunakan Ibator
Pertama install Eclipse plugin dari iBATOR website
Cara install dengan menggunkan Eclipse plugin yaitu:
Take the "Help>Software Updates..." Menu Option
Select the "Available Software" Tab
Press the "Add Site" button
Enter the following information:
- Location:
- http://ibatis.apache.org/tools/ibator
Press OK
Check the box next to "Apache iBATIS Ibator Feature"
Press the "Install" button
Follow the remainder of the install wizard
Cara manual
Download file di http://people.apache.org/builds/ibatis/alpha/ibator-1.2.1-681.zip
Take the "Help>Software Updates..." Menu Option
Select the "Available Software" Tab
Press the "Add Site" button
Press the "Local" button
Navigate to the location where you unzipped the site archive
Press OK
Check the box next to "Apache iBATIS Ibator Feature"
Press the "Install" button
Follow the remainder of the install wizard
Setelah menambahkan ibator kedalam library buildpath Caranya:
Jangan lupa juga memasukan librari untuk Ibatis, mysql-connector dan Spring framework. Bila library di browse akan tampak seperti ini:
kemudian membuat file XML configuration. Cara yang mudah adalah dengan mendownload file http://ibatis.apache.org/dtd/ibator-config_1_0.dtd
sekarang didalam project, klik kanan pada project “New -> Other” and in the list select “XML -> XML” Sorot projectnya, kasir nama file ibatornya misanya iBATORConfig.xml Kemudian klik next.
Pilih Create XML from DTD File -Next- Select file from workspace sorot nama projectnya – klik tombol Import file - from direktori klik tombol browse pilih direktori tempat file DTD nya berada. Beri tanda centang pada dile DTD nya yang lain tidak usah. Lalu klik finish – klik Next - Finish
buat pakage dao.mapping, dao.implement, dao.model
Buka file IbatorConfig.xml. Copas dengan yang ini
setelah di copas replace
xml version="1.0" encoding="UTF-8"?>
DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "src/ibator-config_1_0.dtd" >
<ibatorConfiguration>
<ibatorContext
id="dddd"
targetRuntime="Ibatis2Java5"
defaultModelType="flat">
<jdbcConnection
connectionURL="jdbc:mysql://localhost:3306/sdm"
driverClass="com.mysql.jdbc.Driver"
password="LuPa"
userId="root" />
<javaModelGenerator
targetPackage="dao.model"
targetProject="TestProject" >
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
javaModelGenerator>
<sqlMapGenerator
targetPackage="dao.mapping"
targetProject="TestProject" >
<property name="enableSubPackages" value="true" />
sqlMapGenerator>
<daoGenerator
targetPackage="dao"
type="SPRING"
targetProject="TestProject"
implementationPackage="dao.implement">
<property name="enableSubPackages" value="true" />
<property name="methodNameCalculator" value="extended" />
daoGenerator>
<table tableName="tm_user_pass" domainObjectName="tm_user_passDomain" />
<table tableName="tm_karyawan" domainObjectName="tm_karyawanDomain" />
ibatorContext>
ibatorConfiguration>
Buat file build.xml Gunakan kode dibawah ini
Klik menu Run -External tools - External tools configuration
new Ant build configuration. Pada Tab Main pilih build.xml nya. Tambahkan juga filr jar untuk mysql-connector dan springFramewornya pada tab classpath. Pada tab JRE pilih un in the same JRE as the workspace. Setelah itu klik Run
selesai
Tidak ada komentar:
Posting Komentar