Just one clarification - the default (i.e. PU-wide) event listeners can be
specified in orm.xml (or any other mapping file), not persistence.xml.
-marina
Eve Pokua wrote:
> Hi,
>
> I think you might be looking something like this:
>
> javaeetutorial5\examples\ejb\cart\cart-ejb\src\java\cart\util
>
> BookException.java
>
> in the JEE 5 tutorial. I have seen a better one where the developer has
> specified all the exception messages in a certain class like the one
> above, which extends the Exception class. So it can be called anywhere
> within the application. So message can be reused over and over again.
> It makes it easier to resolve
> errors.
>
> If I find anymore examples, I will update you on this.
>
> eve
>
>
> > Date: Mon, 17 Sep 2007 08:11:52 -0700
> > From: jamesssss_at_yahoo.com
> > To: persistence_at_glassfish.dev.java.net
> > Subject: Re: How to specify default entity listeners via API
> >
> >
> > 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.
>
> ------------------------------------------------------------------------
> Are you the Quizmaster? Play BrainBattle with a friend now!
> <http://specials.uk.msn.com/brainbattle>