persistence@glassfish.java.net

Re: How to specify default entity listeners via API

From: James Sutherland <jamesssss_at_yahoo.com>
Date: Mon, 17 Sep 2007 08:11:52 -0700 (PDT)

There is no default listener in JPA, you would need to specify it on each
Entity.

However TopLink Essentials does provide an API for setting event listeners
through its DescriptorEventManager and
DescriptorEventListener/DescriptorEventAdapter API. You could access this
API through using a SessionCustomizer in your persistence XML, and iterating
of the Session's descriptors (getDescriptors) and accessing the descriptor's
event manager (getEventManager()).

The TopLink DescriptorEventListener provides a larger set of event callbacks
than JPA, you are most likely interested in preInsert, preUpdate, preDelete,
preWrite, but also possibly (aboutToUpdate).

---
http://wiki.java.net/bin/view/People/JamesSutherland James Sutherland 
Farrukh Najmi-2 wrote:
> 
> 
> Is there an API call that allows specifying default Entity Listeners on 
> a persistent context.
> I am looking for an API alternative to specifying it in the 
> persistence.xml descriptor.
> I am unable to find one. Thanks.
> 
> -- 
> Regards,
> Farrukh
> 
> Web: http://www.wellfleetsoftware.com
> 
> 
> 
-- 
View this message in context: http://www.nabble.com/How-to-specify-default-entity-listeners-via-API-tf4443758.html#a12737944
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.