我正在努力嘗試獲得一個簡單的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