http://pure.iteye.com/blog/441845
在新项目中用到了ibatis,如果手写sqlmap和model是很烦的事情,幸好有ibator插件来减轻工作量。
ibator可以生成dao、model、 sqlmap
首先是安装ibator插件:
Eclipse update url
[url] http://ibatis.apache.org/tools/ibator[/url]
安装完后,新建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> <classPathEntry location="D:\\dev\\eclipse\\workspace\\gserver\\lib\\mysql-connector-java-5.1.7-bin.jar" /> <ibatorContext id="context1"> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/xxxx" userId="root" password="mysql" /> <javaModelGenerator targetPackage="com.pure.model" targetProject="mytest" /> <sqlMapGenerator targetPackage="com.pure.maps" targetProject="mytest" /> <daoGenerator targetPackage="com.pure.dao" targetProject="mytest"/> <table tableName="player"> </table> </ibatorContext> </ibatorConfiguration>
选中 ibatorConfig.xml 右键Generate iBATIS Artifacts.