Hmm. Theoretically, this is what the OpenJPAPersistence.getEntityManagerFactory() methods are there for. However, looking at them, there is no way to specify your persistence unit when using those methods. We should add those methods to OpenJPAPersistence.
Am I overlooking something in the implementation of those methods, anyone? -Patrick -- Patrick Linskey BEA Systems, Inc. _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. > -----Original Message----- > From: Hans J. Prueller [mailto:[EMAIL PROTECTED] > Sent: Friday, February 16, 2007 10:31 AM > To: open-jpa-dev@incubator.apache.org > Subject: howto/pattern for working with three databases > outside an EJB3 container > > Hi there, > > > > meanwhile I succeeded in getting OpenJPA to work within my J2EE 1.4 > container and > > I was able to replace a CMP entity bean by a JPA Pojo and > perform basic > operations > > on it (insert/persist, query). > > > > The hi-lo table sequence generator works fine, so I can avoid > conflicts with > existing > > generated PKs already in the database. > > > > Before I can start the real world migration I just want to clarify an > architectural question, > > your ideas would be welcome: > > > > - I am using OpenJPA is "the persistence engine of > choice" now > within our Java2EE 1.4 application > > - all new persistent entities will be created using JPA > > - all existing CMP EBs will be migrated/replaced by > JPA in a longer > process (step by step as this is very complex) > > - the application runs on 3 databases, one for > production data, a > repository of additional stuff and a statistics module > > > > My question is: > > How would the most efficient way look like to integrate > OpenJPA with three > databases within our application (which - from the > > JPA point of view - means outside a container). > > > > I want to avoid to invoke > > > > emFactory = Persistence.createEntityManagerFactory("lbsims"); > > EntityManager em2 = emFactory.createEntityManager(); > > . > > > > every time I need to perform a query of something else. > Somehow there should > be a Util-Class that provides already > > created Factories for all three databases (e.g. persistence > units) within my > application. I already thought about implementing > > this within an abstract base class of all my persistent pojos > - but I think > this isn't a beautiful solution. At least because it > > means mixing technical code with my domain object model. > > > > How are people approaching similar problems? > > > > Any ideas are appreciated! > > > > HANS > > > > > > =========================== > virtually hanzz... > > > > <http://hanzz.zapto.org> http://hanzz.zapto.org (personal) > <http://www.cse.dmu.ac.uk/~hansp> http://www.cse.dmu.ac.uk/~hansp > (research) > > > >