[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] EntityListener not called
|
Try setting logging to finest, ("eclipselink.logging.level"="finest").
Also put a println at the very start of your method to see if it gets
called.
What environment are you using?
philk wrote:
>
> Hello,
>
> I have this Entity Listener defined:
>
> package de.topsystem.common.core.persistence;
>
> import java.util.Properties;
>
> import javax.persistence.PostPersist;
> import javax.persistence.PostUpdate;
>
> import org.osgi.framework.BundleReference;
> import org.osgi.service.event.Event;
> import org.osgi.service.event.EventAdmin;
> import org.osgi.util.tracker.ServiceTracker;
>
> import core.Identifiable;
> import core.annotations.EventTopic;
>
> public class EventAdminEntityListener {
>
> ServiceTracker tracker;
>
> EventAdmin getEventAdmin() {
> if (null == this.tracker) {
> this.tracker = new ServiceTracker(((BundleReference)
> this.getClass().getClassLoader()).getBundle()
> .getBundleContext(), EventAdmin.class.getName(), null);
> this.tracker.open();
> }
> return (EventAdmin) this.tracker.getService();
> }
>
> @PostUpdate
> @PostPersist
> public void postUpdate(final Object entity) {
> if (!(entity instanceof Identifiable<?>) ||
> !entity.getClass().isAnnotationPresent(EventTopic.class)) {
> return;
> }
> final EventAdmin ea = getEventAdmin();
> if (ea != null) {
> final EventTopic topic =
> entity.getClass().getAnnotation(EventTopic.class);
> final Properties properties = new Properties();
> final Identifiable<?> identifiable = (Identifiable<?>) entity;
> properties.put("entity.id", identifiable.getId());
> ea.postEvent(new Event(topic.value() + "/UPDATE", properties));
> }
> }
> }
>
>
> and annotated my Entity like this
> @EntityListeners( { EventAdminEntityListener.class })
> @EventTopic("picker")
> public class LegacyPicker extends BeanModel implements Picker {
> }
>
> The EventAdmiEntityListener is instantiated, so EL can find the class.
> However the annotated method is never called when I merge or persist an
> LegacyPicker entity.
> Can I enable some more logging to understand whats going on?
>
> Thanks in advance,
> Phil
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
-----
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://www.nabble.com/EntityListener-not-called-tp23544166p23635966.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.