Hibernate Auto-generate .hbm and .java
来源:互联网 发布:时期数据和时点数据 编辑:程序博客网 时间:2024/06/07 15:46
This is one of the best descriptions of how to use the Hibernate tools to reverse engineer a DB into ,hbm and .java files automatically.
I will post the description here if it will ever disappear.
- Download the hibernate-tools jar. [i]
- Extract the jar to plugins folder of Eclipse.
- Start eclipse.
- Click on [File -> New -> Other -> Hibernate -> Hibernate Configuration File] and create a cfg file. The following properties should be specified : jdbc url , username, password, DB schema, driver class and dialect.
- Click on [File -> New -> Other -> Hibernate -> Hibernate Console Configuration ] and create a new console configuration. Add the jar file that contains your DB driver in the classpath section at the bottom.
- Enter the name of the console configuration. Click Browse button against the Configuration file and select the cfg.xml file created in step 4.
- Click on [File -> New -> Other -> Hibernate -> Hibernate Reverse Engineering File(reveng.xml) ] and select the location of the file.
- Select the cfg.xml file created in step 4 as the Console Configuration. Click on include button and specift the schema and table name(s) to reverse engineer. Multiple table names can be specifed using sql wild char (eg: TBL_%). Click Finish.
- Click on the Hibernate icon in the tool bar and select the [Hibernate Code Generation ..] option.
- Right click on the [Hibernate Code Generation]tree node and select New.
- Give the name of the configuration and select the console configuartion created in setp 5 and reveng.xml created in step6-7. Also select the Output Directory,
- Go to the Exporters tab and check Generate domain code(.java) and Generate mappings (hbm.xml). Click run.
- The hibernate mapping xml files and Java classes will be created in the output directory specified in step 11.
UPDATE: [i] Some of the new versions of eclipse come with the tools pre installed, if your version has the tools preinstalled jump to step 4
- Hibernate Auto-generate .hbm and .java
- Java生成Hibernate的hbm配置文件
- Auto Generate Item Number
- Hibernate工具生成.hbm.xml及.java文件
- 利用Hibernate Tool 连接数据库, 生成java和hbm.xml
- eclipse中hibernate反创建java和hbm.xml文件
- Auto Generate Sequence in ClientDataSet
- auto and auto&
- hibernate hbm xml query
- hibernate.hbm.xml
- hibernate.hbm.xml详解
- hibernate hbm映射
- hibernate.hbm.xml详解
- hibernate.hbm.xml配置
- Hibernate hbm.xml配置
- hibernate.hbm.xml配置
- hibernate.hbm.xml配置
- hibernate.hbm.xml
- [动态规划]3.3.4 Home on the Range
- JS读取json数据&&循环读取json数据
- JAVA异常学习整理
- Hibernate4实战之Hibernate4注解零配置
- 标准输入输出函数
- Hibernate Auto-generate .hbm and .java
- unity3d透明投影+红外线激光多点触摸+unity win7多点触摸案例
- 英文名称
- wxAUI的使用
- JSF 2.0的一个AJAX例子
- linux 软件安装
- wxWidget之高级框架wxAUI
- eight queens
- <html:select>的重置问题