Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>Is there is a trick how to package Entity classes in different jar files?</p> </blockquote> <p><a href="http://download.oracle.com/otn-pub/jcp/persistence-2.0-fr-eval-oth-JSpec/persistence-2_0-final-spec.pdf?AuthParam=1387374245_74b3b3203a7884d7c62a8ef97097a5c0" rel="nofollow">JPA specification</a> defines several persistence scopes.</p> <blockquote> <p>8.2.2 Persistence Unit Scope An EJB-JAR, WAR, application client jar, or EAR can define a persistence unit.</p> </blockquote> <p>In your case the persistence.xml file packaged within the a.jar file defines a persistence unit that includes only the components defined this jar.</p> <blockquote> <p>A persistence unit that is defined at the level of an EJB-JAR, WAR, or application client jar is scoped to that EJB-JAR, WAR, or application jar respectively and is visible to the components defined in that jar or war.</p> </blockquote> <p>You have several possibilities to expand the scope of your unit persistence. For example define a persistence unit at EAR level:</p> <blockquote> <p>A persistence unit that is defined at the level of the EAR is generally visible to all components in the application...</p> </blockquote> <p>Other possibility is to modify the persistence.xml included in a.jar and explicitly include a reference to b.jar.</p> <blockquote> <p>One or more JAR files may be specified using the jar-file elements instead of, or in addition to the mapping files specified in the mapping-file elements. If specified, these JAR files will be searched for managed persistence classes...Such JAR files are specified relative to the directory or jar file that contains the root of the persis- tence unit.</p> </blockquote> <pre><code>&lt;jar-file&gt;b.jar&lt;/jar-file&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload