, 22 Feb 2007 14:22:25 -0800
Von: Patrick Linskey [EMAIL PROTECTED]
An: open-jpa-dev@incubator.apache.org
CC:
Betreff: RE: RE: Howto integrate JPA within EJB2.1 session beans? [architecture]
Unfortunately, that means that we're using a synchronized
block during the lookup. If it looks like EM
:36 AM
To: open-jpa-dev@incubator.apache.org;
open-jpa-dev@incubator.apache.org
Subject: Re: RE: Howto integrate JPA within EJB2.1 session
beans? [architecture]
Patrick,
thank you for that tip. To be true, I was not aware of
lifecycle related problems between my SLSBs and JPA - thank
CC:
Betreff: RE: Howto integrate JPA within EJB2.1 session beans?
[architecture]
Another common technique is to get an EMF into JNDI, either
by using a
startup hook or deploying OpenJPA as a JCA RAR.
Are you looking to integrate OpenJPA with your current managed
Hans,
Instead of managing the lifecycle of the EntityManagerFactory and
EntityManager yourself, why not use injection of the EM via
@PersistenceContext? There are several examples of this usage in the JPA
spec and the OpenJPA documentation.
Kevin
On 2/21/07, Hans Prueller [EMAIL PROTECTED]
One way to provide acccess to EntityManagerFactory/EntityManager to the
SLSB is to collate JPA-related facilities into a separate class (say
PersistenceService). PersistenceService will
a) ensure EntityManagerFactory is created once (or at least not too
often) as that is the 'heavy' operation
b)
Another common technique is to get an EMF into JNDI, either by using a
startup hook or deploying OpenJPA as a JCA RAR.
Are you looking to integrate OpenJPA with your current managed
transaction? If so, I'd be careful about creating an EM in ejbCreate(),
as its lifecycle is related to the life of