mybatis代码生成

自动生成 mybatis代码,特别是sqlmap文件,可以有效的减少dao等代码的重复劳动。
eclipse中添加插件: mybatis Generator - http://mybatis.googlecode.com/svn/sub-projects/generator/trunk/eclipse/UpdateSite/


添加生成代码的配置文件







location="/home/xxx/xxx.war/WEB-INF/lib/mysql-connector-java-5.1.6.jar" />









connectionURL="jdbc:mysql://localhost/test" userId="test"
password="123456">






targetProject="Test-web">




targetProject="Test-web">




type="GENERIC-CI" />


enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">













在文件上点击鼠标右键,可以看到插件生成的选项,选择即可生成代码

daoGenerator 标签的类型,见如下链接.
http://ibatis.apache.org/docs/tools/abator/configreference/daoGenerator.html

IBATIS The generated DAO objects will conform to the iBATIS DAO framework.
GENERIC-CI The generated DAO objects will rely only on the SqlMapClient. The SqlMapClient will be supplied by constructor dependency injection.
GENERIC-SI The generated DAO objects will rely only on the SqlMapClient. The SqlMapClient will be supplied by setter dependency injection.
SPRING The generated DAO objects will conform to the Spring DAO framework.

你可能感兴趣的:(数据库,java,开发工具,数据库)