Friday, October 9, 2009

Multiple Persistence Units in JAVA EE project

Hello All,

If you are trying to create multiple persistence units in your JAVA EE project...the below is how you do it...I recently had to do this for one of my projects and it worked great...

Persistence.xml should look like below



  
    provideryouareusing
    jdbc/db1
    entity.entity1
    entity.entity2
    true
    
    
  
  
    jdbc/db2
    entity.entity3
    true
    
  


In the entity manager bean class you have to clearly specify which PU is the entity using...something like shown below...

@PersistenceContext(unitName="PUname")

let me know if you have any questions...

0 comments:

Post a Comment

About This Blog

In this blog you will find simple but great ideas on various topics ranging from food recipes to investment strategies. I hope the ideas presented in this blog will help you all in some way or other. Also included are the recent and hot news around the world...

Go ahead and grasp my ideas...

Disclaimer and Terms of Use

All the ideas and opinions provided herein are intended to share and inform simple and useful information. They come with no warranty of any kind. If you should choose to interpret graspmyideas.blogspot.com information as perfect working ideas, or advice or if you want to completely rely on these ideas, you do so at your own risk.

This site is offered as is and without warranties of any kind. We are not responsible for timeliness, accuracy, unavailability or interruptions in availability, viruses or other defects in the site or its contents. In no event shall graspmyideas.blogspot.com site or its authors are responsible for any damages to users or their computer systems.


Your Ad Here

  © Blogger template AutumnFall by Ourblogtemplates.com 2008

Back to TOP