On 10/29/07, Vusa Dube <[EMAIL PROTECTED]> wrote: > > Hi guys, > I'm slowly migrating a JSP/JDBC application to my new found love, JPA and > I'm loving it. I'm making my first babysteps in JPA. > > Previously, when a user logs in, the application looks up their name in > the main database, and obtains the database they're supposed to use and > creates a new Connection object on that database which can then be passed to > any method that needs to use it. This way, I determine the database to use > at runtime. > > With JPA, I see I need to define a persistence unit in the > persistence.xmlfile for each database. Is there a way of defining one > persistence unit and > then pass the database name as a parameter at runtime? I'm looking at > something like setting the database property for the EntityManagerFactory > object (I'm manually creating the EntityManager object since I'm doing some > of this stuff in JSP's). > > > Vusi. > > > Can't you use http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManagerFactory.html#createEntityManager(java.util.Map) to achieve the same effect?
"Don't take the name of root in vain." Jeff Mutonho Cape Town South Africa GoogleTalk : ejbengine Skype : ejbengine Registered Linux user number 366042 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CTJUG Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/CTJUG-Forum For the ctjug home page see http://www.ctjug.org.za -~----------~----~----~----~------~----~------~--~---
