[jboss-user] [EJB 3.0] - Re: Single persistence.xml file with multiple EJB jars

jaikiran do-not-reply at jboss.com
Thu Mar 27 12:46:38 EDT 2008


Okay in that case, probably you can place the persistence.xml in the META-INF folder of any one of the ejb jars. Let's assume you placed it in msp1_ejb.jar. The persistence.xml can then contain this:

<?xml version="1.0" encoding="UTF-8"?>
  | <persistence xmlns="http://java.sun.com/xml/ns/persistence">
  | 	<persistence-unit name="msp-par">
  | 		<jta-data-source>java:/@deployeddatabase@</jta-data-source>
  | 		<jar-file>../</jar-file>
  | 		<jar-file>../../msp2_ejb.jar</jar-file>
  | 		<properties>
  | 			<property name="hibernate.hbm2ddl.auto" value="false"/>
  | 			<property name="com.intellij.javaee.persistence.datasource" value="Datasource"/>
  | 		</properties>
  | 	</persistence-unit>
  | </persistence>


This way both the ejb jar files will be scanned for the entities. I tried this scenario on my local setup of JBoss-4.2.2 and this seems to be working. It picked up the entities that were spread across (and not replicated) the 2 ejb jars. Try it out and see if it works for you.
   

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

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



More information about the jboss-user mailing list