wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Accessing multiple databases with JPA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Accessing multiple databases with JPA" Watch "Accessing multiple databases with JPA" New topic
Author

Accessing multiple databases with JPA

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Hi,

I am trying to access multiple databases from an enterprise application. How to configure the persistance unit if i have to access multiple databases.

Can i have multiple persistence units in the persistence.xml file.

Please suggest me on this.

Thanks,
Srikanth.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

Originally posted by Srikanth Reddy:
Hi,

I am trying to access multiple databases from an enterprise application. How to configure the persistance unit if i have to access multiple databases.


You can configure each persistence unit to use one database. So if you have multiple databases, you can configure the corresponding number of persistence units.

Originally posted by Srikanth Reddy:

Can i have multiple persistence units in the persistence.xml file.



As per the xsd http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd, yes you can have multiple persistence units in a single xml file.


[My Blog] [JavaRanch Journal]
Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Thanks a lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing multiple databases with JPA
 
Similar Threads
Database connection in servlet
Distributed Tx and Transactional File Access
JPA/Hibernate: Selecting data from second database?
Passed Certification. A few thoughts.
how to access names of different databases