我正在努力尝试获得一个简单的Envers示例工作。我被困在org.hibernate.tool.ant.EnversHibernateToolTask
—它看起来像我终于得到了我需要的所有jar文件,但现在我得到错误信息什么是JPA配置?
[hibernatetool] Persistence unit not found: 'ConsolePU'.
BUILD FAILED
C:\deka\proj\java\test-database\build.xml:61: Persistence unit not found: 'ConsolePU'.
据我所知,持久化单元与JPA persistence.xml
文件关联。但我没有使用persistence.xml文件;我使用的hibernate.cfg.xml —但envers例如在蚂蚁任务<jpaconfiguration>
:
<hibernatetool destdir=".">
<classpath>
<fileset dir="src/">
<include name="**/*.hbm.xml"/>
</fileset>
<path location="${buildDir}" />
</classpath>
<jpaconfiguration persistenceunit="ConsolePU" />
<hbm2ddl
drop="false"
create="true"
export="false"
outputfilename="versioning-ddl.sql"
delimiter=";"
format="true"/>
</hibernatetool>
是有什么,我可以取代它,以让它与hibernate.cfg.xml的工作文件?似乎有关于如何让所有这些东西正常工作的ZERO文档。
编辑: OK,所以主要的问题是我不明白的hibernatetool选项,什么是适合我的应用程序。幸运的是,我确实发现了Hibernate ant docs。谢谢。现在我遇到一个新问题:我正在使用注释,但我也为属性设置设置了hibernate.cfg.xml。 hibernatetool
任务只允许我运行<configuration />
或<annotationconfiguration />
不能同时运行,即使<configuration />
也不能运行,因为我已经有了注释功能。我如何将我的属性设置从hibernate.cfg.xml文件迁移到我的注释中?
编辑:咄,我不知道你只是做:
<annotationconfiguration configurationfile="...filename..." />
完成(我希望)... upvoted但不被接受(没有人碰到头了) – 2009-06-22 14:14:36