• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Persistence Unit reference JAR/WAR/EAR

 
Greenhorn
Posts: 26
Firefox Browser Oracle Java
  • 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>
 
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?
 
Can you shoot lasers out of your eyes? Don't look at this tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!