Myeclispe下mybatis generator的使用

准备:下载附件包解压到myeclispe的dropins文件夹下
选择项目
1.新建config文件

[img]http://dl2.iteye.com/upload/attachment/0118/4413/ab7f9d0e-6f58-3824-a10e-49dfcb908841.png[/img]
配置路径

[img]http://dl2.iteye.com/upload/attachment/0118/4421/bde3c189-f3df-35ff-a77a-d9b1d13b00e9.png[/img]


2.配置config
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
<generatorConfiguration >
<!--数据库驱动-->
<classPathEntry location="E:\lib\mysql-connector-5.1.8.jar" />
<context id="contextMybatis" >
<!--数据库链接地址账号密码-->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.126.128:3306/test?useUnicode=true&characterEncoding=UTF-8"
userId="test"
password="test" />
<!--生成Model类存放位置-->
<javaModelGenerator targetPackage="Model" targetProject="Mybatis" />
<!--生成映射文件存放位置-->
<sqlMapGenerator targetPackage="Mapper" targetProject="Mybatis" />
<!--生成Dao类存放位置-->
<javaClientGenerator targetPackage="Dao" targetProject="Mybatis" type="XMLMAPPER" />
<!--生成对应表及类名-->
<table tableName="user"
domainObjectName="user" enableInsert="true"
enableSelectByPrimaryKey="true" enableUpdateByPrimaryKey="true"
enableDeleteByPrimaryKey="true" enableSelectByExample="false"
enableDeleteByExample="false" enableCountByExample="false"
enableUpdateByExample="false">
</table>
<table tableName="role"
domainObjectName="role" enableInsert="true"
enableSelectByPrimaryKey="true" enableUpdateByPrimaryKey="true"
enableDeleteByPrimaryKey="true" enableSelectByExample="false"
enableDeleteByExample="false" enableCountByExample="false"
enableUpdateByExample="false">
</table>
</context>
</generatorConfiguration>

3.右击配置文件,点击下图矩形框选项即可

[img]http://dl2.iteye.com/upload/attachment/0118/4423/2bded122-a013-377a-977a-27247b4300b0.png[/img]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值