[jboss-user] [EJB 3.0] - Re: Persistence unit scoping across multiple jars in a singl

k34216 do-not-reply at jboss.com
Mon Aug 14 12:23:16 EDT 2006


Right, but in my tests, if you had different unit names then the entity beans couldn't have any relationships between them.

The only solution I have found is like raja05 said, is to put the persistence.xml in a jar file in the ear file. And then reference from that persistence.xml file all the other jars.


"grdzeli_kaci" wrote : hi all, i had already problem like this and my mistake was that i hadn't  unitname in the persistance.xml file 
  | i think if u must add this in u your persistance.xml 
  | 
  | 
  |   | 	<persistence-unit name="Blah1" transaction-type="JTA">
  |   | 		<jta-data-source>java:/XAOracleDS</jta-data-source>
  |   | 		<class>com.magti.businesslayer.ejb3entity.oracle.Test</class>
  |   | 		<properties>			
  |   | 		 [props]
  |   | 		</properties>
  |   | 	</persistence-unit>	
  |   | 
  |   | 
  | in second persistanc.xml
  | 
  |   | 	<persistence-unit name="Blah2" transaction-type="JTA">
  |   | 		<jta-data-source>java:/XAOracleDS</jta-data-source>
  |   | 		<class>com.magti.businesslayer.ejb3entity.oracle.Test</class>
  |   | 		<properties>			
  |   | 		 [props]
  |   | 		</properties>
  |   | 	</persistence-unit>	
  |   | 
  |   | 
  | 
  | u also could put more then one persistance unit in one persistance.xml file
  | 
  |   | 	<persistence-unit name="Blah1" transaction-type="JTA">
  |   | 		<jta-data-source>java:/XAOracleDS</jta-data-source>
  |   | 		<class>com.magti.businesslayer.ejb3entity.oracle.Test</class>
  |   | 		<properties>			
  |   | 		 [props]
  |   | 		</properties>
  |   | 	</persistence-unit>	
  |   | 	<persistence-unit name="Blah2" transaction-type="JTA">
  |   | 		<jta-data-source>java:/XAOracleDS</jta-data-source>
  |   | 		<class>com.magti.businesslayer.ejb3entity.oracle.Test</class>
  |   | 		<properties>			
  |   | 		 [props]
  |   | 		</properties>
  |   | 	</persistence-unit>	
  |   | 
  |   | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965037#3965037

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965037



More information about the jboss-user mailing list