Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Specific EntityListener Instance?

You can add a SessionEventListener or DescriptorEventListener to your Session
or ClassDescriptor.

i.e.
em.unwrap(Session.class).getEventManager().addListener(listener);
or,
em.unwrap(Session.class).getDescriptor(MyClass.class).getEventManager().addListener(listener);

See,
http://www.eclipse.org/eclipselink/api/2.1/org/eclipse/persistence/descriptors/DescriptorEventListener.html


Florian Schaetz-2 wrote:
> 
> Hello,
> 
> for my current project I would like to know if there's a way to use a 
> specific (in other words: Not automatically created, but created by my 
> code explicitly) instance of a class as an EntityListener? Or is there 
> any way (if EntityListeners don't allow that) to have a specific 
> instance of a class notified of every @PostLoad event happening in my 
> Entities? I can't use a static getter to access my object, so I need 
> some way to connect my object to the PostLoad event... Any chance to do 
> that? Is there something like EntityManager.addListener( ... )?
> 
> Regards,
> 
> Flo
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/Specific-EntityListener-Instance--tp29591276p29641784.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top