-
1. Re: Persistence unit picks a few entity classes from module dependency but not all
prashanto.chatterjee Jun 18, 2013 12:59 AM (in response to prashanto.chatterjee)I am migrating my applications from JBoss AS 6 to JBoss AS 7.1.1.Final. Presently I am just trying to deploy an EAR that only houses the persistence unit.
-
2. Re: Persistence unit picks a few entity classes from module dependency but not all
jaikiran Jun 18, 2013 1:33 AM (in response to prashanto.chatterjee)You can't have those jar files outside of the deployment packaging. The spec states:
JPA2 spec, section 8.2.1.6.3
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, and any mapping metadata annotations found on them will be pro-
cessed, or they will be mapped using the mapping annotation defaults defined by this specification.
Such JAR files are specified relative to the directory or jar file that contains[82] the root of the persis-
tence unit.[83]
-
3. Re: Persistence unit picks a few entity classes from module dependency but not all
prashanto.chatterjee Jun 18, 2013 1:43 AM (in response to jaikiran)When I started building my persistence unit I was bundling all the requisite JARs together in the application. It was just by accident that I discovered that a few entities were getting picked up from module dependencies. Is that something by accident or is there some configuration that is aiding this?
Since we have a pluggable architecture it would work in my favor if I am able to let extensions drop their entity JARs in their own modules.
Here is my deployment structure:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
</exclusions>
<dependencies>
<module name="javax.faces.api" slot="1.2" export="true" />
<module name="com.sun.jsf-impl" slot="1.2" export="true" />
<module name="org.dom4j" export="true" />
<module name="org.hibernate.validator.legacy" slot="4.0.2" export="true" />
<module name="org.apache.tools.ant" export="true" />
<module name="com.avaya.mgmt.logging" export="true" />
<module name="com.avaya.mgmt.console.faces" export="true" />
<module name="com.avaya.mgmt.console.framework" export="true" />
<module name="com.avaya.mgmt.cim.jpa" export="true" />
<module name="com.avaya.mgmt.securestore" export="true" />
<module name="com.avaya.mgmt.geo.client" export="true" />
<module name="com.avaya.mgmt.pif.client" export="true" />
<module name="com.avaya.mgmt.spm.spmcommon" export="true" />
<module name="org.springframework" slot="2.5.6" export="true" />
<!-- <module name="deployment.SMGRPersistence.ear.SMGRPersistence.jar" /> -->
</dependencies>
<resources>
<resource-root path="pan_plugin_frmwk_Manager.jar" />
</resources>
</deployment>
<sub-deployment name="pan_plugin_frmwk_Servlet.war">
</sub-deployment>
<sub-deployment name="pan_plugin_frmwk_Ui.war">
</sub-deployment>
</jboss-deployment-structure>
And here is my persistence unit definition. There are some old properties using which we got it working when migrating from 4.2.3 to AS 6.
<persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <persistence-unit name="SMGRPersistenceUnit"> <jta-data-source>java:/jdbc/com/avaya/mgmt/avSysDB</jta-data-source> <jar-file>file:${jboss.home.dir}/modules/com/avaya/mgmt/cim/jpa/main/cs_cim_jpa.jar</jar-file> <class>com.avaya.security.securestore.entities.CSEncryptionKey</class> <class>com.avaya.security.securestore.entities.CSSecureStore</class> <properties> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> <!-- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
--> <property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagerFactories/UserMgmtSeamPersistenceFactory"/> <property name="jta.UserTransaction" value="java:comp/UserTransaction"/> <!-- <property name="hibernate.ejb.event.flush-entity" value="com.avaya.coreservice.persistence.CimPreFlushEntityEventListener, org.hibernate.ejb.event.EJB3FlushEntityEventListener, com.avaya.coreservice.persistence.CimPostFlushEntityEventListener"/> --> <!-- Do not run Hibernate validator for every insert and update --> <property name="hibernate.validator.autoregister_listeners" value="false"/> <!-- Rescans the classes from the jar files --> <property name="hibernate.ejb.resource_scanner" value="org.hibernate.ejb.packaging.NativeScanner"/> </properties> </persistence-unit> </persistence>
-
4. Re: Persistence unit picks a few entity classes from module dependency but not all
prashanto.chatterjee Jun 18, 2013 3:06 AM (in response to prashanto.chatterjee)The entities that I have defined under 'class' are getting picked from module dependency <module name="com.avaya.mgmt.securestore" export="true" />.