I defined two persistence units in my persistence.xml to connect to two
different databases (one is MySQL and other to MS SQL) like below

<persistence xmlns="http://java.sun.com/xml/ns/persistence";
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
version="1.0"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";>
    <persistence-unit name="CallingCardUsersUnit">
        <description>Entity Beans to db1</description>
       
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <non-jta-data-source>db_users_notx</non-jta-data-source>
                <class>com.xyz.services.app.model.entity.users.User</class>
                <class>com.xyz.services.app.model.entity.users.UserRole</class>
                
<class>com.xyz.services.app.model.entity.users.UserAccount</class>
                <properties>
                        <property name="/tmp/openjpa.log" value="SQL=TRACE" />
                </properties>
    </persistence-unit>
    
    <persistence-unit name="DigittalkUnit">
        <description>Entity Beans for db2</description>
       
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <non-jta-data-source>billing_notx</non-jta-data-source>
        <class>com.xyz.services.app.model.entity.billing.BUser</class>
        <class>com.xyz.services.app.model.entity.billing.BAccount</class>
                <properties>
                        <property name="/tmp/openjpa.log" value="SQL=TRACE" />
                </properties>
    </persistence-unit>
    
    
</persistence>


When my app first starts up and runs, I need to access entity
com.xyz.services.app.model.entity.users.User, JPA tries to load entiry
com.xyz.services.app.model.entity.users.User and then it tries to create
table BUser and BAccount in the first persistence unit. BUser and BAccount
are listed in second persistence unit. Also, BUser and BAccount are mapped
to existing tables in second persistence unit.

Can someone help me since I do not understand why it happens. Also, How can
I turn of the auto create table. 

Thanks
-B
-- 
View this message in context: 
http://n2.nabble.com/Problem-with-multi-persistence-units-tp2303818p2303818.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to