出口模式与Hibernate的注解

编程入门 行业动态 更新时间:2024-10-14 00:31:56
本文介绍了出口模式与Hibernate的注解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用Hibernate注解,我想导出我的数据库架构。

I'm using hibernate annotations and i want to export my database schema.

与HBM XML文件schemaexporttask类似。

Similar to the schemaexporttask with hbm xml files.

推荐答案

事实上,原来的Hibernate核心 SchemaExportTask 只能处理Hibernate XML映射文件,没有注释。你需要的是 HibernateToolTask​​ 随 Hibernate的工具的。

Indeed, the original Hibernate Core SchemaExportTask can only handle Hibernate XML mapping files, not annotations. What you need is the HibernateToolTask that comes with Hibernate Tools.

下面是一个使用示例改编自Java持久性使用Hibernate:

Here is an Usage example adapted from Java Persistence With Hibernate:

<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.classpath"/> <target name="schemaexport" depends="compile, copymetafiles" description="Exports a generated schema to DB and file"> <hibernatetool destdir="${basedir}"> <classpath path="${build.dir}"/> <configuration configurationfile="${build.dir}/hibernate.cfg.xml"/> <hbm2ddl drop="true" create="true" export="true" outputfilename="helloworld-ddl.sql" delimiter=";" format="true"/> </hibernatetool> </target>

另请参见

  • Hibernate 3的注释和放大器;蚂蚁
  • See also

    • Hibernate 3 Annotations & Ant

更多推荐

出口模式与Hibernate的注解

本文发布于:2023-05-29 03:34:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/335834.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:注解   模式   Hibernate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!