FROM: http://ibatis.apache.org/ibator.html
생성된 ibatorConfig.xml파일의 초기상태
지정한 패키지에 iBATIS 관련 코드가 생성된 것을 확인할 수 있다.
iBator Eclipse Plugin
iBator 플러그인을 Eclipse 3.5에 설치하는 절차
위와같은 절차를 따라서 Eclipse에 iBator플러그인이 설치되었다면, 다음과 같이 iBator를 사용하여 iBATIS관련 구성파일을 자동으로 작성할 수 있다.
먼저 ibator설정파일(디폴트로 ibatorConfig.xml)을 생성한다.
생성된 ibatorConfig.xml파일의 초기상태
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" >
<ibatorConfiguration >
<ibatorContext id="context1" >
<jdbcConnection driverClass="???" connectionURL="???" userId="???" password="???" />
<javaModelGenerator targetPackage="???" targetProject="???" />
<sqlMapGenerator targetPackage="???" targetProject="???" />
<daoGenerator targetPackage="???" targetProject="???" type="GENERIC-CI" />
<table schema="???" tableName="???" >
<columnOverride column="???" property="???" />
</table>
</ibatorContext>
</ibatorConfiguration>
<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" >
<ibatorConfiguration >
<ibatorContext id="context1" >
<jdbcConnection driverClass="???" connectionURL="???" userId="???" password="???" />
<javaModelGenerator targetPackage="???" targetProject="???" />
<sqlMapGenerator targetPackage="???" targetProject="???" />
<daoGenerator targetPackage="???" targetProject="???" type="GENERIC-CI" />
<table schema="???" tableName="???" >
<columnOverride column="???" property="???" />
</table>
</ibatorContext>
</ibatorConfiguration>
다음과 같이 데이터베이스 연결정보 및 자동으로 생성될 파일의 경로를 설정한다.
ibatorConfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" >
<ibatorConfiguration >
<ibatorContext id="context1" >
<jdbcConnection driverClass="oracle.jdbc.OracleDriver"
connectionURL="jdbc:oracle:thin:@micropilot.co.kr:1521:ORCL"
userId="scott" password="tiger" />
<javaModelGenerator targetPackage="jdbctest" targetProject="TestWeb/src" />
<sqlMapGenerator targetPackage="jdbctest" targetProject="TestWeb/src" />
<daoGenerator targetPackage="jdbctest" targetProject="TestWeb/src" type="GENERIC-CI" />
<table schema="scott" tableName="emp" domainObjectName="Emp">
<!-- <columnOverride column="???" property="???" /> -->
</table>
</ibatorContext>
</ibatorConfiguration>
<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" >
<ibatorConfiguration >
<ibatorContext id="context1" >
<jdbcConnection driverClass="oracle.jdbc.OracleDriver"
connectionURL="jdbc:oracle:thin:@micropilot.co.kr:1521:ORCL"
userId="scott" password="tiger" />
<javaModelGenerator targetPackage="jdbctest" targetProject="TestWeb/src" />
<sqlMapGenerator targetPackage="jdbctest" targetProject="TestWeb/src" />
<daoGenerator targetPackage="jdbctest" targetProject="TestWeb/src" type="GENERIC-CI" />
<table schema="scott" tableName="emp" domainObjectName="Emp">
<!-- <columnOverride column="???" property="???" /> -->
</table>
</ibatorContext>
</ibatorConfiguration>
다음과 같이 iBATIS 관련 파일들을 자동으로 생성한다.
지정한 패키지에 iBATIS 관련 코드가 생성된 것을 확인할 수 있다.