On Sat, Nov 7, 2009 at 7:53 PM, rtselvan <[email protected]> wrote: > > There may be some difference in what you are doing though. I have one only > persistence unit in the XML file and connecting to different database based > on the user/organization. This avoids to creating a lot of persistence unit > and as well, ability to add additional organization without having change > the persistence unit xml file. >
Yeah, I definitely want to be able to add and drop organizations while the application is live, thus no changes to persistence.xml. But isn't a one to one correspondence between persistence unit and database implied? How does JPA know the difference between 2 entities of the same class with the same ID but from different databases? I'm using a DataSource to get connections from my connection pool, I can see clearly how I can choose a connection from different databases, but I would think JPA would get very confused if I did that. -- Daryl Stultz _____________________________________ 6 Degrees Software and Consulting, Inc. http://www.6degrees.com mailto:[email protected]
