hbm2ddl hbm2java
来源:互联网 发布:下载数字数软件 编辑:程序博客网 时间:2024/04/19 01:42
hbm2ddl hbm2java 的使用说明 (由小组linan 整理)
hbm2DDL hbm2Java Hibernater的Hbm文件转化操作
1. 调用SchemaExport转Hibernate的hbm文件到 DDL文件
public class SchemaExportTest {
public static void main(String []args){
String []tmpPro = new String[3];
tmpPro[0] = "D:/workspaces/Temp/goat-hbm.xml";
tmpPro[1] = "--output=D:/workspaces/Temp /goat-hbm-new.sql";
tmpPro[2] = "--properties=D:/workspaces /Temp/hibernate.properties";
//--config=用于定义使用的配置的方式为XML文件
/**
--quiet don't output the script to stdout
public static void main(String []args){
String []tmpPro = new String[3];
tmpPro[0] = "D:/workspaces/Temp/goat-hbm.xml";
tmpPro[1] = "--output=D:/workspaces/Temp
tmpPro[2] = "--properties=D:/workspaces
//--config=用于定义使用的配置的方式为XML文件
/**
--quiet don't output the script to stdout
--config=用于定义使用的配置的方式为XML文件
--drop only drop the tables
--text don't export to the database
--output=my_schema.ddl output the ddl script to a file
--properties=hibernate.properties read database properties from a file
--format format the generated SQL nicely in the script
--delimiter=x set an end of line delimiter for the script
**/
SchemaExport.main(tmpPro);
}
}
--drop only drop the tables
--text don't export to the database
--output=my_schema.ddl output the ddl script to a file
--properties=hibernate.properties read database properties from a file
--format format the generated SQL nicely in the script
--delimiter=x set an end of line delimiter for the script
**/
SchemaExport.main(tmpPro);
}
}
要求有Log4j的配置文件及数据库的驱动程序
2. 调用JavaGenerator类转化HBM文件到Java的PO JO文件,此种方式可直接修改Hibernate的文件 ,从而达到修改POJO的目地,此包在hibernate -extensions的项目中,Hibernate -extensions的项目中包括class2hbm ddl2hbm hbm2java三个子项目
public static void main(String[] args) {
String mappingFile = GenerJavaPOJO.class.getResource(".").getPath()
+ "HibernateMappingTest.hbm.xml";
String[] param = new String[]{mappingFile,
"--output=" + System.getProperty("user.dir")+"/src/"};
CodeGenerator.main(param);
}
String mappingFile = GenerJavaPOJO.class.getResource(".").getPath()
+ "HibernateMappingTest.hbm.xml";
String[] param = new String[]{mappingFile,
"--output=" + System.getProperty("user.dir")+"/src/"};
CodeGenerator.main(param);
}
如果直接使用Hibernate-Extends的包,则要求用Hibernate2.jar的文件,因为此版本还不支持Hibernate3,因此附件中有一个对Hibernate3进行改造过的
hbm2java的代码,直接加入到项目代码中就可以使用,就不在需要Hiberanate2.jar的文件了
3. Middlegen 根据数据库Schema自动生成映射文件,可直接用Eclipse 的工具直接转化
附件中包括部分的示例文档及Hibernate-extensio ns的一个Src包
另其中的两个Java文件是修改了Hbm2Java的源代码 ,使其支持DefaultValue,从而在POJO文件中自动生 成缺省值
- hbm2ddl hbm2java
- hibernate3.2 hbm2java hbm2ddl
- Hibernate Tool: hbm2java or hbm2ddl
- Hibernate Tool: hbm2java or hbm2ddl
- hbm2java和hbm2ddl工具的使用
- hbm2java和hbm2ddl工具的使用
- hbm2java和hbm2ddl的使用步骤
- hbm2java和hbm2ddl工具的使用
- Hibernate tools的hbm2ddl和hbm2java
- hibernate3下hbm2ddl和hbm2java的配置
- 运行hbm2java工具和hbm2ddl工具
- hbm2java和hbm2ddl的使用步骤
- hbm2java和hbm2ddl的使用步骤
- Hibernate3中的hbm2java和hbm2ddl的ant脚本实现
- Hibernate3中的hbm2java和hbm2ddl的ant脚本实现(转)
- 《精通Hibernate》学习(2)——hbm2java和hbm2ddl工具
- 使用Hibernate-tools中的hbm2java和hbm2ddl根据hbm文件自动生成pojo和数据库脚本
- 使用Hibernate-tools中的hbm2java和hbm2ddl根据hbm文件自动生成pojo和数据库脚本
- SQL语句大全
- SQL语句大全2
- 审视 Ajax,第 2 部分: 使用 mashup 改变您的生活
- 审视 Ajax,第 1 部分: 透过华而不实的广告看本质
- sizeof用法
- hbm2ddl hbm2java
- VC招聘要求:MIS系统 数据库Oracle Slqserver 等及访问机制,一定要熟悉
- if 和 if...else的意义
- OLE应用小记
- C++字符串完全指南 - Win32字符编码(一)
- C++字符串完全指南 - Win32字符编码(二)
- C++字符串完全指南(2) - 各种字符串类(一)
- const使用详解(转贴)
- 从 DataSet 对象更新数据库