2

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

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
Jorge
  • 17,896
  • 19
  • 80
  • 126

1 Answers1

4

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
  • 3,663
  • 2
  • 26
  • 32