0

我确实完全按照搜索 8.2.2 Persistence Unit Scope 之一中的规范进行操作,但它未能抛出异常,例如

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>
4

1 回答 1

0

persistence.xml应该放在模块的META-INF文件夹中ejb-jar。在这种情况下,您可以persistence.xml不使用<jar-file>. 所有实体都将自动注册。

如果你想使用<jar-file>,那么路径应该是

<jar-file>../../entities1.jar</jar-file>
<jar-file>../../entities2.jar</jar-file>  

什么意思my-persistence-xml.jar。是jarxml

于 2012-09-18T20:32:54.000 回答