it's possible configure a persistence.xml for multiple data sources?
hi i just want to know how configure in a per开发者_Python百科sistence.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
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>
精彩评论