openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hans J. Prueller" <hans.pruel...@gmx.net>
Subject howto/pattern for working with three databases outside an EJB3 container
Date Fri, 16 Feb 2007 18:30:35 GMT
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)

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message