Hanya Sebagai Pengingat

=================================

Selasa, 21 Juli 2009

Ibator Eclipse

Menggunakan Ibator

Pertama install Eclipse plugin dari iBATOR website

Cara install dengan menggunkan Eclipse plugin yaitu:

  1. Take the "Help>Software Updates..." Menu Option

  2. Select the "Available Software" Tab

  3. Press the "Add Site" button

  4. Enter the following information:

    Location:
    http://ibatis.apache.org/tools/ibator
  5. Press OK

  6. Check the box next to "Apache iBATIS Ibator Feature"

  7. Press the "Install" button

  8. 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

  1. Take the "Help>Software Updates..." Menu Option

  2. Select the "Available Software" Tab

  3. Press the "Add Site" button

  4. Press the "Local" button

  5. Navigate to the location where you unzipped the site archive

  6. Press OK

  7. Check the box next to "Apache iBATIS Ibator Feature"

  8. Press the "Install" button

  9. 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


default="generateDAO">


name="generateDAO">

configfile="/root/workspace/TestProject/IbatorConfig.xml" >



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: