openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: how to use openjpa event listener ?
Date Mon, 10 Aug 2009 14:12:05 GMT

Illhan -

Did you read the section in the user manual detailing the usage of Lifecycle
Callbacks [1]?

-Rick

[1]http://openjpa.apache.org/builds/latest/docs/manual/manual.html#jpa_overview_pc_callbacks


illhan wrote:
> 
> hi Rick,
> The EntityManager and the EntityManagerFactory are initializated by the
> JEE contianer.I think the LifecycleListener could be set in
> persistent.xml,not only used by java code.
> Thanks Rick.
> 
> illhan
> 
> Rick Curtis wrote:
>> 
>> Illhan -
>> In your application initialization I believe you could do something like
>> this to get a reference to the EntityManagerFactory....
>> 
>> 		OpenJPAEntityManager oem = OpenJPAPersistence.cast(em);
>> 		OpenJPAEntityManagerFactory oemf =
>> OpenJPAPersistence.cast(oem.getEntityManagerFactory());
>> 
>> - Rick
>> 
>> illhan wrote:
>>> 
>>> In the javadoc there are many event and listener.I want to use the event
>>> and the listener in jee enviroment,the emf.add**Listener() method can't
>>> not called because in jee enviroment the entitymanagerfacetory is
>>> created by jee contianer.i only use ejb3 injection in my session bean
>>> use   @PersistenceContext
>>>     private EntityManager em;
>>> so i don't know how to register the Listener(such as LifecycleListener)
>>> in JEE enviroment.
>>> 
>>> illhan
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/how-to-use-openjpa-event-listener---tp3397042p3417396.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message