[jboss-user] [EJB 3.0 Users] - Store multiple persistence units in one entity manager facto
newmanw10
do-not-reply at jboss.com
Fri Dec 11 16:27:30 EST 2009
I am a little confused so please bear with me.
I have two persistence units myPU1 and myPU2. Each is defined in a separate jar file. I want to get both of these persistence units into JNDI.
I also want both persistence units in the same entity manager factory (if that is possible)
I know that I have to use one of the following properties in my persistence.xml but I am not sure which or if I need both:
| <?xml version="1.0" encoding="UTF-8"?>
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
| http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
|
| <persistence-unit name="myPU1" transaction-type="JTA">
| <jta-data-source>java:myDS</jta-data-source>
| <properties>
| <!-- Store entity manager and factory in global JNDI -->
| <property name="jboss.entity.manager.jndi.name" value="myPU1"/>
| <property name="jboss.entity.manager.factory.jndi.name" value="myPU1"/>
| </properties>
|
| </persistence-unit>
| </persistence>
|
I have another file that is identical except for the persistence unit name (myPU2). Can I bind both of those to the same factory?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4270294#4270294
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4270294
More information about the jboss-user
mailing list