geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Some jpa questions
Date Thu, 24 Aug 2006 23:38:30 GMT

On Aug 24, 2006, at 10:41 AM, David Jencks wrote:

> I've been looking at the ejb 3 persistence spec and it looks to me  
> as if there are some poorly explained bits.  Anyone have any clues  
> about these or any clue about where I could get an answer?
> 1. The @PersistenceContext annotation appears to be per jee  
> component (web app or ejb).  You can specify a map of properties to  
> pass in to the EMF.createPersistenceContext method.  Lets suppose  
> you have tx scoped PC, and you have 2 ejbs with tx Required and one  
> calls the other, and one specifies a map of properties and the  
> other doesn't (or they specify different maps).  What's supposed to  
> happen?


I don't think it ever was established that the container had to  
consider and evaluate vendor specific data while determining if two  
entity managers are equivalent.  It's vendor specific data, you have  
no logical way to evaluate it.  You can do a string equals, but it's  
not your data and you don't actually know if that's significant.

> 2. What's supposed to happen when you try to use a CM tx scoped EM  
> outside a JTA tx?  Section 5.6.1 seems to imply we aren't supposed  
> to just throw an exception, but section 5.9.1 seems to imply there  
> is no provider EM in back of the CM EM to do any work without a JTA  
> tx.  Are we supposed to create and close a provider EM for each  
> call outside a tx?

You can call read-only operations on the EntityManager with no tx and  
no exceptions thrown, you just can't call the write methods persist,  
merge, remove, and refresh.

> I'm sure I'll have more questions later....  I have one more non- 
> spec question which perhaps I need to ask the openjpa guys...
> - How heavyweight are EntityManagers?  Is it more efficient to  
> create a new one or pool them?  Are they cheap enough so every CM  
> tx-scoped EM can have a "outside tx" provider EM attached to it in  
> case anyone is dumb enough to do work outside a tx?  Is this more  
> or less resource efficient than creating a new EM for each out-of- 
> tx use?

That I don't know.


> thanks
> david jencks

View raw message