This content has been marked as final.
Show 2 replies
-
1. Re: How to work with 2 databases simultaneously?
keithahern May 7, 2006 10:44 PM (in response to keithahern)bump, surely there are people out there working with 2 databases? In my cases its adapting a legacy database to work with a new architecture.
How do I assign an entity bean to a database? -
2. Re: How to work with 2 databases simultaneously?
cyril.joui May 8, 2006 11:36 AM (in response to keithahern)Hello,
It's totally possible.
Here is an example :<?xml version="1.0"?> <persistence version="1.0"> <persistence-unit name="transactionUP"> <jta-data-source>java:Stock1DS</jta-data-source> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>com.labosun.stockmanager.entity.Transaction</class> <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" /> </properties> <exclude-unlisted-classes /> </persistence-unit> <persistence-unit name="stockmanagerUP"> <jta-data-source>java:Stock2DS</jta-data-source> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>com.labosun.stockmanager.entity.FinancialProduct</class> <class>com.labosun.stockmanager.entity.Bond</class> <class>com.labosun.stockmanager.entity.Portfolio</class> <class>com.labosun.stockmanager.entity.Stock</class> <class>com.labosun.stockmanager.entity.Portfolio</class> <class>com.labosun.stockmanager.entity.User</class> <class>com.labosun.stockmanager.entity.AccountInfo</class> <class>com.labosun.stockmanager.entity.Address</class> <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" /> </properties> <exclude-unlisted-classes /> </persistence-unit> </persistence>
Don't hesitate to ask for questions.
Good luck.