Hi, today I tried to add some hibernate event listeners to my application. This was my first naive approach:

in AppModule
public static void contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer> config) { config.add("EventListener", new EventListenerHibernateConfigurer());
    }

my EventListener
public class EventListenerHibernateConfigurer implements HibernateConfigurer {

    @Inject
    SolrIndexer solrIndexer;

    @Inject
    private HibernateSessionSource hss;

    @Override
    public void configure(Configuration configuration) {
EventListenerRegistry registry = ((SessionFactoryImpl) hss.getSessionFactory()).getServiceRegistry().getService(
                EventListenerRegistry.class);
registry.getEventListenerGroup(EventType.PERSIST).appendListener(new MyPersistEventListener(solrIndexer));
    }
  }

First of all I found no way of register an event only with the configuration object (http://stackoverflow.com/questions/8616146/eventlisteners-using-hibernate-4-0-with-spring-3-1-0-release). Second the injection does not work. But how do I get my SolrIndexer into the my event listener?

Thanks in advance
Matthias

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to