Hi Pinaki,

We tried the code you suggested. Now problem is, Entities are replicated in
both entity manager i.e. I can see DB2 entities list in SQL server entity
manager. do you know why it is happening?

Java code
######################################
/** 
         * 
         * <p>persistent context unit for SQLServer</p>
         * 
         * @generated "UML-to-EJB 3.0
(com.ibm.xtools.transform.uml2.ejb3.java.internal.UML2EJB3Transform)"
         */
        @PersistenceContext(unitName="MIApplicationSQL")
        private EntityManager emSqlServer; 

        /** 
         * 
         * <p>DB2 entity manager</p>
         * 
         * @generated "UML-to-EJB 3.0
(com.ibm.xtools.transform.uml2.ejb3.java.internal.UML2EJB3Transform)"
         */
        @PersistenceContext(unitName="MIApplicationDB2")
        private EntityManager emDB2;
###############################################
<persistence version="2.0"
        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_2_0.xsd";>
        <persistence-unit name="MIApplicationSQL" transaction-type="JTA">
                <description>MIApplication Datasource</description>
                <jta-data-source>jdbc/MIApplicationSQL</jta-data-source>
                <class>com.jeeframework.persistence.Area</class> 
                <properties>
                        <property name="openjpa.Log" 
value="SQL=TRACE,JDBC=TRACE" />
                </properties>
        </persistence-unit>
        <persistence-unit name="MIApplicationDB2" transaction-type="JTA">
                <description>MIApplication Datasource</description>
                <jta-data-source>jdbc/MIApplicationDB2</jta-data-source>
                <class>com.jeeframework.persistence.User</class> 
                <properties>
                        <property name="openjpa.Log" 
value="SQL=TRACE,JDBC=TRACE" />
                </properties>
        </persistence-unit>
</persistence>

If we create two different persistent.xml (one for DB2 unit and other for
SQL server unit) then, can we make both entity manager as part of single
transaction so that we can achieve XA transaction?

thanks
chintan

--
View this message in context: 
http://openjpa.208410.n2.nabble.com/How-to-find-entity-belong-which-EntityManger-tp6470903p6479214.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to