MyBatisGenerator的自动生成代码之MyEclipse
来源:互联网 发布:制作视频片头软件 编辑:程序博客网 时间:2024/05/23 21:41
api
http://mbg.cndocs.tk/
MyEclipse用MyBatiesGenerator自动生成跟Eclipse不同,MyEclipse不能安装MyBatiesGenerator插件
所以这里我们可以参考http://mbg.cndocs.tk/running/runningWithMaven.html这一章,通过maven手动添加一个插件,手动运行来编译generatorConfig.xml文件,
从而实现自动生成代码
generatorConfig.xml配置文件
<?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><!-- api --><!--http://mbg.cndocs.tk/--> <context id="context1"> <!-- 生成根配置文件(jdbc) --> <jdbcConnection connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" driverClass="oracle.jdbc.OracleDriver" password="tiger" userId="scott" /> <!-- 生成emp表的mybatis代码 生成emp的实体类 将表当成类名 列名当成属性名 targetPackage包类 targetProject生成在哪个项目里 --> <javaModelGenerator targetPackage="cn.et.mybatis.lesson04.mbg.entity" targetProject="E:\MyEclipse 8.5\Workspaces\MybatisLesson\src" /> <!-- 生成接口映射的代码 java接口 --> <sqlMapGenerator targetPackage="cn.et.mybatis.lesson04.mbg.dao" targetProject="E:\MyEclipse 8.5\Workspaces\MybatisLesson\src" /> <!-- 生成xml或者注解 targetProject属性 XMLMAPPER 生成xml ANNOTATEDMAPPER 生成注解 --> <javaClientGenerator targetPackage="cn.et.mybatis.lesson04.mbg.dao" targetProject="E:\MyEclipse 8.5\Workspaces\MybatisLesson\src" type="XMLMAPPER" /> <!-- 选择数据库的表 schema方案 每个用户都有一个唯一的方案,方案名等于用户名 tableName表名 把Example后缀的方法都关闭掉,用不上 --> <table schema="scott" tableName="emp" enableCountByExample="false" enableSelectByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" > </table> </context></generatorConfiguration>
pom.xml
添加二个maven架包
<dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.3</version></dependency><dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.3</version></dependency>
添加一个plugin标签
<!-- My Eclipse不能安装MBG 所以这里我们要配置一个插件来运行generatorConfig.xml配置文件 --> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.3</version> <!-- 告诉插件配置文件的路径 --> <configuration> <configurationFile>generatorConfig.xml</configurationFile> </configuration> <!-- 插件运行的过程中需要ojdbc架包的支持,所以在这里要配置ojdbc架包 --> <dependencies> <dependency> <groupId>oracle</groupId> <artifactId>orcale</artifactId> <version>3.2.8</version> <scope>system</scope> <systemPath>C:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar</systemPath></dependency> </dependencies> </plugin>
运行插件
new一个插件
配置如下
最后Run就可以了
阅读全文
0 0
- MyBatisGenerator的自动生成代码之MyEclipse
- MyBatisGenerator的自动生成代码之MyEclipse
- MyBatisGenerator的自动生成代码之Eclipse
- MyBatisGenerator的自动生成代码之Eclipse
- MybatisGenerator的自动生成
- Mybatis自动代码生成插件MybatisGenerator使用
- MyBatisGenerator 自动生成java代码(反向工具)
- MBG(mybatisgenerator)自动生成工具
- mybatisGenerator 代码自动生成报错 Result Maps collection already contains value for BaseResultMap
- mybatisGenerator 代码自动生成报错 Result Maps collection already contains value for BaseResultMap
- mybatisGenerator 代码自动生成报错 Result Maps collection already contains value for BaseResultMap
- myeclipse设定代码自动生成的风格
- myeclipse注册码自动生成的代码
- myeclipse、MyEclipse注册码自动生成代码
- 编辑MyEclipse自动生成的代码文件的注释
- 利用Myeclipse自动生成webService客户端代码
- 利用Myeclipse自动生成webService客户端代码
- (转)myeclipse自动生成注册码代码
- H5的video元素实现的Demo
- C++ 枚举类型作用域的思考
- 关于安装完MyEclipse之后的一系列配置操作
- 挂黑链的十大方式
- 公钥私钥和数字签名
- MyBatisGenerator的自动生成代码之MyEclipse
- BaseServiceImpl中的实现关键点
- JSONModel的模型嵌套
- jvm 内存模型
- 6月15日,每日20行。
- JDBC中Statement、PreparedStatement和CallableStatement的使用
- 移动支付的思考
- caffe中tools的万能使用
- jquery各种选择器和函数