eclipse使用hibernate tools插件生成mysql数据表的pojo
来源:互联网 发布:无间道风云知乎 编辑:程序博客网 时间:2024/05/29 02:03
参考文章:http://www.cnblogs.com/mrsui/archive/2013/06/20/3146335.html
本文环境:eclipse4.4.0+hibernate4.1+hibernate tools4.0.1+mysql5.7
1 安装hibernate tools插件:
help -> Eclipse Marketplace
注:eclipse会搜索出适合该版本eclipse安装的hibernate tools,点击安装即可安装
2 创建hibernate配置文件hibernate.cfg.xml及console配置文件
2.1新建Java或者Java web项目,这里建立了一个Java web项目hibernate_taotao,建立cn.com.pojo package存放pojo等
2.2选中项目,右键-> new -> other -> hibernate -> hibernate configuration file
2.3然后 next,配置console文件,创建了配置文件hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.password">ccssxx</property> <property name="hibernate.connection.url">jdbc:mysql://127.0.0.1:3306/taotao?characterEncoding=utf-8</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property> </session-factory></hibernate-configuration>
3 创建hibernate.reveng.xml文件:
3.1选中项目,右键 -> new -> other -> hibernate -> hibernate reverse engineering file
3.2下一步,配置要生成POJO对应的表
3.3finish生成hibernate.reveng.xml文件
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" ><hibernate-reverse-engineering> <table-filter match-catalog="taotao" match-name="tb_content"/> <table-filter match-catalog="taotao" match-name="tb_content_category"/> <table-filter match-catalog="taotao" match-name="tb_item"/> <table-filter match-catalog="taotao" match-name="tb_item_cat"/> <table-filter match-catalog="taotao" match-name="tb_item_desc"/> <table-filter match-catalog="taotao" match-name="tb_item_param"/> <table-filter match-catalog="taotao" match-name="tb_item_param_item"/> <table-filter match-catalog="taotao" match-name="tb_order"/> <table-filter match-catalog="taotao" match-name="tb_order_item"/> <table-filter match-catalog="taotao" match-name="tb_order_shipping"/> <table-filter match-catalog="taotao" match-name="tb_user"/></hibernate-reverse-engineering>
4 反向工程创建pojo:
4.1 在java模式下的hibernate code generation configuration菜单中配置
4.2点击run配置成功,生成pojo和对应的XX.hbm.xml文件
5 一般自动生成的mapping文件(XX.hbm.xml)都需要修改后才能使用:
- eclipse使用hibernate tools插件生成mysql数据表的pojo
- eclipse使用hibernate tools插件生成POJO
- eclipse使用hibernate tools插件生成POJO
- eclipse使用hibernate tools插件使用、以及生成POJO
- 使用Eclipse的hibernate插件生成POJO
- 使用hibernate tools插件生成POJO
- 使用hibernate tools插件生成POJO
- 使用Hibernate Tools 反向生成POJO
- 施用hibernate tools插件反向数据库生成POJO
- 使用Hibernate Tools从数据库表生成pojo和hbm
- Hibernate Tools for Eclipse插件的安装和使用
- Hibernate Tools for Eclipse插件的安装和使用
- Hibernate Tools for Eclipse插件的安装和使用【转】
- Eclipse插件hibernate tools的安装和使用
- Hibernate Tools for Eclipse插件的安装和使用【转】
- Hibernate Tools for Eclipse插件的安装和使用
- Eclipse安装Hibernate tools插件自动生成代码
- eclipse使用hibernate tools插件错误org.hibernate.console.HibernateConsoleRuntimeException:
- 星球大战给我们的6个关于用户体验的启示
- 区域赛后
- 查找轮廓并获取最大轮廓的所有点
- Chrome浏览器查看cookie
- neutron之lbaas v2
- eclipse使用hibernate tools插件生成mysql数据表的pojo
- csdn评论博客文章的时候,怎样防止<>转义成<>
- JZOJ5441. 【NOIP2017提高A组冲刺11.1】序列 启发式搜索+迭代深搜
- 栈调试分析
- 深蓝回来了:离散化
- Zookeeper分布式锁实现
- Linux(Ubuntu)下 下载和安装Tomcat
- hibernate4.1.1 从入门到总结
- Spring jpa @Query map