aspose file tools*
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 Java 8 in Action this week in the Java 8 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: 9337
    
110

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
how to access names of different databases
Passed Certification. A few thoughts.
Distributed Tx and Transactional File Access
Database connection in servlet
JPA/Hibernate: Selecting data from second database?