1:abator Download: http://ibatis.apache.org/abator.html
2: Install Abator into Eclipse
3: You can create a new file type at this point: Abator for Ibatis Configuration File, set up a
4: JDBC Connection for the database to be mapping in Jdbcconnection
Classpathentry is your JDBC driver classpath
5: Javamodelgenerator,sqlmapgenerator,daogenerator set up Java dataObject, SQL mapping file and DAO interface, build location of implementation class: Targetpackage Target Package , you can set properties Type:ibatis or spring in the Targetproject:eclipse project
6:daogenerator Specifies whether the generated DAO implementation class is using the Com.ibatis.dao.client.template.SqlMapDaoTemplate
or
Org.springframework.orm.ibatis.support.SqlMapClientDaoSupport
7:table tablename Specifies the name of the table to be processed
can have multiple table
8: Table can contain child elements Generatedkey: Enables the Insert method to return a value--the SQLStatement property in the specified column mapping
9:generatedkey can be the SQL that gets the sequence , or it can be a SQL
that gets its own value: Oracle's Select Thesequence.nextval from dual
SQL Server's SELECT @ @IDENTITY as column_name
10 : Save file, select File, right-click menu to select Generate IBATIS artifacts!
All parameters are written in this root node, which can be used to generate a Ibatis configuration file, Java beans, and DAO
A property of Abatorcontext Generatorset has 3 options legacy, JAVA2, Java5
Legacy: If there is no Generatorset attribute, the default is Legacy. But it is not recommended to use legacy because it has a lot of limitations when it comes to generating example classes (for query conditions), he writes the query criteria in the SQLMAP configuration file, writes the query value in example, which makes it difficult to modify.
Java2 and JAVA5: They only support the Ibatis version of more than 2.20. The query criteria and query values are included in the example file that is genetic in this pattern. This is much easier to modify, for the select query when the join is more convenient, you can define the query conditions, freedom is much higher (for join and query may have to modify the example code). The restrictions on the application of OR and and legacy are relatively large.
Describes the properties of JDBC and the location of its jar packages.
, and describes a self generated location. The Medium Type property is used to tell Abator whether the DAO generated is for containers such as Ibatis or spring.
XML code
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE abatorconfiguration Public "-//apache Software foundation//dtd abator for IBATIS Configuration"
"Http://ibatis.apache.org/dtd/abator-config_1_0.dtd" >
<abatorConfiguration>
<abatorcontext generatorset= "Java2" > <!--todo:add Database Connection Information-->
<jdbcconnection driverclass= "Oracle.jdbc.driver.OracleDriver"
Connectionurl= "Jdbc:oracle:thin:@192.168.80.119:1521:po2db"
Userid= "Lnga"
password= "123" >
<classpathentry location= "D:/lnga/lnga/project/trunk/src/main/webapp/web-inf/lib/classes12.jar"/>
</jdbcConnection>
<javamodelgenerator targetpackage= "Com.iflytek.model.pojo" targetproject= "Lnga"/>
<sqlmapgenerator targetpackage= "Com.iflytek.dao.sqlMap" targetproject= "Lnga"/>
<daogenerator type= "SPRING" targetpackage= "Com.iflytek.dao" targetproject= "Lnga" >
<property name= "Enablesubpackages" value= "true" ></property>
</daoGenerator>
<table tablename= "Ajcb_anjian" ></table>
<table tablename= "Ajcb_anjianbeizhu" >
</table>
</abatorContext>
</abatorConfiguration>