On Apr 24, 2007, at 10:35 PM, Patrick Linskey wrote:

Yep -- you've gotta keep it open. If you want to support any JPA impl,
you need to have an EM proxy (please please please make it a dynamic
proxy that implements all the interfaces that the proxied thing
implements).

That code is from my proxy.

If you're happy tying yourself to OpenJPA (or if you want to optimize
for OpenJPA), then you can use the openjpa.AutoDetach property to tell
OpenJPA how to handle non-transactional work. In that scenario, you can keep a single EM per your delegating instance, and rely on OpenJPA to do
the transactional PC semantics.

I just might give that a try.

If I want to have generic code, how am I supposed to implement the createNamedQuery method? Do I leave the EM open forever? That doesn't seem right. So when am I supposed to close the EM?

-dain

Reply via email to