我确实按照搜索8.2.2持久性单位范围中的规格进行了跟踪, 但它没有像
那样抛出异常15:08:09,956 WARNING [FileZippedJarVisitor] Unable to find file (ignored): file:entities1.jar
java.io.FileNotFoundException: entities1.jar (The system cannot find the file specified)
...similarly other one too
这是耳朵的结构:
|-ear--
|-lib--|... some libs ...
| |--my-persistence-xml.jar
|--entities1.jar
|--entities2.jar
|-ejb-1.jar
|-web-1.war
这是持久性:
<persistence-unit name="pu" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/mypu</jta-data-source>
<jar-file>entities1.jar</jar-file>
<jar-file>entities2.jar</jar-file>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true" />
</properties>
</persistence-unit>
答案 0 :(得分:0)
persistence.xml
应放在META-INF
模块的ejb-jar
文件夹中。在这种情况下,您可以使用persistence.xml
而不使用<jar-file>
。所有的entites将自动注册。
如果您想使用<jar-file>
,则路径应为
<jar-file>../../entities1.jar</jar-file>
<jar-file>../../entities2.jar</jar-file>
my-persistence-xml.jar
的含义。这是jar
或xml
?