您的位置:首页 >> 编程开发 >> Java >> Struts/Hibernate >> 正文
Struts/Hibernate RSS
 

用ant来执行hibernate所自带sechmaExport的工具

http://www.rdxx.com 04年12月30日 12:12 Blog 我要投稿

关键词: 执行 , Hibernate , Export , CHM , 工具 , Ant , port , NT , NAT
jianglibo 于 2004年 07月27日 发表

既然在eclipse环境下工作,最好所有相关的工作都能在它里面完成。hibernate自带了一个工具schemaExport,可以让你从map文件产生数据库的ddl。
在eclipse project中新建一个目录,schemae,然后新建两个文件。schemae.xml,schema.properties。

schema.properties的内容:

neededClassPath=c:/hibernate-2.1.4/hibernate-2.1/hibernate2.jar;c:/hibernate-2.1.4/hibernate-2.1/lib/dom4j-1.4.jar;c:/hibernate-2.1.4/hibernate-2.1/lib/commons-collections-2.1.jar;c:/hibernate-2.1.4/hibernate-2.1/lib/commons-logging-1.0.3.jar;c:/hsqldb_1_7_1/hsqldb/lib/hsqldb.jar;D:/eclipse-SDK-2.1.2-win32/eclipse/workspace/fhjsj/bin/;D:/eclipse-SDK-2.1.2-win32/eclipse/workspace/fhjsj/fhjsj/WEB-INF/classes/

schema.xml的内容:

<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. --&rt;
<project name="schemaExport" default="schemaexport" basedir="."&rt;

<property file="schemae.properties"/&rt;

<target name="schemaexport"&rt;
<taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
classpath="${neededClassPath}"/&rt;

<schemaexport
quiet="no"
text="true"
drop="no"
delimiter=";"
output="workspace/fhjsj/schemae/schema-export.sql"&rt;
<fileset dir="../fhjsj/WEB-INF/classes/"&rt;
<include name="**/*.hbm.xml"/&rt;
</fileset&rt;
</schemaexport&rt;
</target&rt;
</project&rt;


其它的hibernate.properties和mapping 文件根据web程序的规范放在WEB-INF的classes里面。最后产生的ddl文件放在schemae目录下面。


 
 
标签: 执行 , Hibernate , Export , CHM , 工具 , Ant , port , NT , NAT 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站