| I just wanted to see if we all agree that the root of the persistence unit is not the META-INF folder but the folder that contains the META-INF. From jpa2.1 spec section "8.2 Persistence Unit Packaging":
Within Java EE environments, an EJB-JAR, WAR, EAR, or application client JAR can define a persistence unit. Any number of persistence units may be defined within these scopes.
A persistence unit may be packaged within one or more jar files contained within a WAR or EAR, as a set of classes within an EJB-JAR file or in the WAR classes directory, or as a combination of these as defined below.
A persistence unit is defined by a persistence.xml file. The jar file or directory whose META-INF directory contains the persistence.xml file is termed the root of the persistence unit. In Java EE environments, the root of a persistence unit must be one of the following:
• an EJB-JAR file • the WEB-INF/classes directory of a WAR file [87] • a jar file in the WEB-INF/lib directory of a WAR file • a jar file in the EAR library directory • an application client jar file
Some examples from the referenced jpa2.1 spec section "8.2.1.6.3 Jar Files":
Example 6: app.ear lib/earEntities.jar war2.war WEB-INF/classes/META-INF/persistence.xml persistence.xml contains: <jar-file>../../lib/earEntities.jar</jar-file> Example 7: app.ear lib/earEntities.jar war1.war WEB-INF/lib/warPUnit.jar (with META-INF/persistence.xml ) persistence.xml contains: <jar-file>../../../lib/earEntities.jar</jar-file>
|