• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Persistence Unit reference JAR/WAR/EAR

 
Sebastien French
Greenhorn
Posts: 26
Firefox Browser Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I was reading the JPA specification and there is something I can't understand (8.2.1.6.3 examples ).
We have a lot of example of how to point to a jar file containing entities.

Example 5:
app.ear
war2.war
WEB-INF/lib/warEntities.jar WEB-INF/classes/META-INF/persistence.xml
persistence.xml contains: <jar-file>lib/warEntities.jar</jar-file>


I think I am wrong but persistence.xml should contain : <jar-file>../lib/warEntities.jar</jar-file> ?

Could you please give me a piece of advice on that purpose ?

In the same way if we look at :


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>

I think it should contain <jar-file>../../lib/earEntities.jar</jar-file>
 
Cesar Koot
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's important to know what the persistence unit root is. The persistence unit root is the JAR or directory that contains the META-INF directory where the persistence.xml file is located.

So I'm with you on both examples: I think it needs to be ../lib/warEntities.jar for the first and in the second example, in which the JAR is the root, I believe it needs to be ../../lib/earEntities.jar

Can anyone shed a light on this please?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic