打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Ant编写hbm2java脚本对Hibernate2和3的区别

对于Hibernate2,要下载hibernate-extensions,把hibernate-tools.jar放入classpath中.
Ant的脚本如下:
<!-- property definition omitted -->
<taskdef name="hbm2java" classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask" classpathref="project.class.path" />

<target name="codegen" description="Generate Java source from the O/R mapping files">
<hbm2java output="${source.root}">
   <fileset dir="${source.root}">
    <include name="**/*.hbm.xml" />
   </fileset>
</hbm2java>
</target>

----------------------------------------------------------

对于Hibernate3,则要下载对应的HibernateTools包,这里以HibernateTools-3.2.0.GA.zip举例.
把其中的/plugins/org.hibernate.eclipse_3.2.0.GA/lib/tools目录下:
hibernate-tools.jar 和 freemarker.jar 包copy到classpath中.
Ant的脚本如下:
<taskdef name="hbm2java" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.class.path" />

<target name="codegen" description="Generate Java source from the O/R mapping files">
<hbm2java destdir="${source.root}">
  <configuration>
    <fileset dir="${source.root}">
     <include name="**/*.hbm.xml" />
    </fileset>
  </configuration>
  <hbm2java /><!-- this should be added to show this is a hbm2java task -->
</hbm2java>
</target>

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
通过XDoclet(ant)生成Hibernate映射文件
Ant多项功能配置
用hbm2java生成Hibernate类
ANT+Xdoclet自动生成Hibernate配置文件\映射文件(正确)
Eclipse快速上手Hibernate--2.利用Hbm映射文件开发
JAVA org.apache.tools.ant.taskdefs.Zip 压缩/解压缩
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服