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?

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?


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?

thanks
david jencks

Reply via email to