0

Every time I configure orm.xml in the Persistance.xml I get the following:

E CWWJP0015E: An error occurred in the org.hibernate.ejb.HibernatePersistence persistence provider when it attempted to create the container entity manager factory for the XYZ persistence unit. The following error occurred: PersistenceUnit: XYZ Unable to build EntityManagerFactory

If I remove the entry from Persistance.xml it works fine, but the `Entity Manager is not able to locate the entity class since I am not using JPA annotation.

4

1 回答 1

0

重命名Persistance.xmlpersistence.xml 注意,p小写字母,并且单词“persistence”不包含字母a

另外,请确保persistence.xml位于适当的位置:

以下来自JPA 规范

A persistence.xml file defines a persistence unit. The persistence.xml file is 
located in the META-INF directory of the root of the persistence unit. 
The root of the persistence unit is the key here.

如果您是非 Java EE 应用程序

The jar file or directory whose META-INF directory contains the persistence.xml 
file is termed the root of the persistence unit.

如果您在 Java EE 应用程序中,则以下内容有效

在 Java EE 环境中,持久性单元的根必须是以下之一:

• EJB-JAR 文件

• WAR 文件的 WEB-INF/classes 目录[80]

• WAR 文件的 WEB-INF/lib 目录中的 jar 文件

• EAR 库目录中的 jar 文件

• 应用程序客户端 jar 文件

于 2013-11-12T01:50:14.410 回答