views:

42

answers:

1

hi i just want to know how configure in a persistence.xml two datasources one of the data sources have a jar outside from the other. I'm tried but i really don't if it's possible

+2  A: 

Yeah, you can have two datasources configured in a persistence.xml. You would just need two separate elements.

<persistence>
   <persistence-unit name="datasourceOne">
       <jta-data-source>java:/DefaultDS</jta-data-source>
       <jar-file>../MyApp.jar</jar-file>
       <class>org.acme.Employee</class>
       <class>org.acme.Person</class>
       <class>org.acme.Address</class>
       <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
       </properties>
   </persistence-unit>

   <persistence-unit name="datasourceTwo">
     <!-- some configuration -->
  </persistence-unit>
</persistence>
stratwine