Dan, I went through a lot of this recently with OpenJPA.  YMMV with other 
providers.

1. OpenJPA doesn't seem to manage very well with base classes across bundle 
boundaries.  It looked like there needed to be more magic in place that it 
could deal with not being able to enhance or otherwise modify the superclass 
jar due to classloader isolation.  I did set up build time enhancement but it 
didn't seem to be enough and I forgot where I was in the code that it was a 
problem.  One solution to this *may* be to use fragment hosts.  For now, we've 
just duplicated the base classes across the persistence bundles, kicking the 
can down the road a bit.  

2. I have been successful in having multiple persistence units in the same 
Karaf runtime and sharing a single data source, but the PUs do need to be named 
differently.  We have noticed some race conditions that occur, turning on JPA 
logging seems to bury them a little deeper, and we haven't had time to explore 
what's going on so we can report it.  

3. One of the issues with multiple PUs is you need to set them up with 
different names for the sequence tables under DBs like Postgres and Oracle.  
This can be done statically from persistence.xml.

I'm very interested in resolutions to these issues and would like to contribute 
to them, but have been under a lot of pressure with client deadlines.  I wonder 
if others have seen any of these issues yet and can offer any better advice 
than this.

Cheers, B

On Sep 26, 2012, at 9:01 PM, Dan Tran <[email protected]> wrote:

> Hi,
> 
> I am porting a set of JPA moduels under spring to Karaf JPA where I
> have i module which contains abstract entity classes, and a couple of
> other JPA modules use the 'base module', is it possible under
> jpa/openjpa/derby??
> 
> I am struggling on what do do with the base module since it has no
> entities, what the persistent.xml looks like, should it has its own
> persistent unit?
> 
> Can all three modules use the same persistent unit name?
> 
> any suggestion is greatly appreciated.
> 
> thanks
> 
> -D

Reply via email to