Mybatis自动生成java所需模型
来源:互联网 发布:网络销售是什么意思 编辑:程序博客网 时间:2024/06/14 06:09
生成时所需的xml文件(例子为postgresql)
<?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="D:\generator\postgresql-9.2-1003-jdbc4.jar" /> <context id="tts2"> <jdbcConnection driverClass="org.postgresql.Driver" connectionURL="jdbc:postgresql://localhost:5432/reporter_web" userId="postgres" password="root"> </jdbcConnection> <!-- 生成模型的包名和位置 --> <javaModelGenerator targetPackage="cn.ssms.model" targetProject="D:\generator\src"> <property name="enableSubPackages" value="true" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <!-- 生成的映射文件包名和位置 --> <sqlMapGenerator targetPackage="cn.ssms.mapping" targetProject="D:\generator\src"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <!-- 生成DAO的包名和位置 --> <javaClientGenerator type="XMLMAPPER" targetPackage="cn.ssms.dao" targetProject="D:\generator\src"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <!--准备生成的数据表,以下为三张表--> <table schema="public" tableName="clinical_c" domainObjectName="ClinicalC"></table> <table schema="public" tableName="clinical_e" domainObjectName="ClinicalE"></table> <table schema="public" tableName="clinical_ec" domainObjectName="ClinicalEc"></table> </context></generatorConfiguration>
执行命令
在xml所放位置,打开cmd窗口,输入 java -jar mybatis-generator-core-1.3.2.jar -configfile mybaits.xml -overwrite
其它数据库
<!-- 数据库链接URL、用户名、密码 --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/demo?characterEncoding=utf8" userId="root" password="root"> <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" userId="root" password="root"> </jdbcConnection>
0 0
- Mybatis自动生成java所需模型
- maven + mybatis 自动生成所需pojo、dao、mapper
- java 自动生成 mybatis
- eclipse 使用maven generator 插件自动生成mybatis所需代码
- 使用工具生成mybatis所需文件
- Java自动生成mybatis更新sql语句
- java自动生成mybatis新增sql语句
- Java MyBatis自动生成映射文件
- 利用mybatis-gernerator插件生成mybatis 所需文件
- 用mybatis-gennerator插件自动生成mybatis所需要的dao、bean、mapper xml文件
- myBatis自动生成工具
- mybatis 自动生成配置文件
- mybatis自动生成
- MyBatis代码自动生成
- mybatis自动生成
- mybatis自动生成工具
- mybatis 自动生成代码
- Mybatis自动生成代码
- 如何配置 maven 的 resources 的资源复制为强制覆盖???
- camera摄像原理之四:曝光和GAMMA
- 走出 JNDI 迷宫
- Javascript面向对象之五工厂模式-《javascript设计模式》笔记 (赞)
- gradient has outdated direction syntax
- Mybatis自动生成java所需模型
- 国内可用maven repository 配置
- HTTP请求返回的数字代表的具体含义
- LeetCode ---- Add Digits (Java/Lua 实现)
- 面试感悟----一名3年工作经验的程序员应该具备的技能
- jsp原理详解
- emacs terminal
- windows 下C++对象池实现,支持并发
- postgresql中角色和权限的问题