2 Replies Latest reply on Mar 26, 2006 2:32 PM by Cyril JOUI

    Two persistence-unit ...

    Cyril JOUI Newbie

      Hello,

      I try to have two use two different DB in my EJB Tier.
      I have my persistence.xml :

      <?xml version="1.0"?>
      <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="Stock1">
       <jta-data-source>java:Stock1DS</jta-data-source>
       <class>com.labosun.stockmanager.entity.Transaction</class>
       <properties>
       <property name="hibernate.hbm2ddl.auto" value="update" />
       <property name="hibernate.dialect"
       value="org.hibernate.dialect.MySQLInnoDBDialect" />
       </properties>
       </persistence-unit>
      
       <persistence-unit name="Stock2">
       <jta-data-source>java:Stock2DS</jta-data-source>
       <class>com.labosun.stockmanager.entity.FinancialProduct</class>
       <class>com.labosun.stockmanager.entity.Obligation</class>
       <class>com.labosun.stockmanager.entity.Portfolio</class>
       <class>com.labosun.stockmanager.entity.Stock</class>
       <class>com.labosun.stockmanager.entity.StockExchange</class>
       <class>com.labosun.stockmanager.entity.StockPortfolio</class>
       <class>com.labosun.stockmanager.entity.User</class>
       <class>com.labosun.stockmanager.entity.AccountInfo</class>
       <properties>
       <property name="hibernate.hbm2ddl.auto" value="update" />
       <property name="hibernate.dialect"
       value="org.hibernate.dialect.MySQLInnoDBDialect" />
       </properties>
       </persistence-unit>
      
      </persistence>
      


      But when I deploy my application, JBoss update Stock1 and Stock2 with all @Entity annotated classes but I specified that Stock1 have Transaction and Stock2 the others ...
      Does my persistence.xml correct ?

      Thanks by advance.