persistence@glassfish.java.net

Example use of jar-file element in persistence.xml

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Mon, 12 Dec 2005 22:20:57 +0530

Hi Mike,

In the spec section #6.2.1.6 I find the following:

*Such JAR files are specified relative to the root of the persistence
unit (e.g.,
../utils/myUtils.jar).
*
I am confused by existence of *..* in the example above. I want to
clarify the use of jar-file using a couple of examples:

1)
a.ear
       utils/myUtils.jar
       par.jar#META-INF/persistence.xml (contains utils/myUtils.jar as
jar-file)
       ejb.jar

In the example above, if some PU defined in *par.jar* includes classes
from *myUtils.jar*, then persistence.xml will contain
*utils/myUtils.jar* as jar-file. I say this because if there were a
Class-Path attribute in par.jar's manifest file, then its value would
have been utils/myUtils.jar.

2) Also, I would like to clarify use of jar-file in a PU defined
inside a war file.
a.ear
       utils/myUtils.jar
       foo.war#WEB-INF/classes/META-INF/persistence.xml

In the example above, if some PU defined in
foo.war#WEB-INF/classes/META-INF/persistence.xml includes classes from
*myUtils.jar*, then persistence.xml will contain
../../*utils/myUtils.jar* as jar-file.

Would you mind confirming if the above two usage of jar-file is correct
or not?

Thanks,
Sahoo