OK, I've done a search on the forum, and a few people have had questions about events, but not this one.
I am working with Hibernate embedded in JBoss.
I have a multipurpose event listener, configured by
Code:
<event type="pre-update">
<listener class="com.fcl.util.HibernateEventListener"/>
</event>
<event type="post-commit-update">
<listener class="com.fcl.util.HibernateEventListener"/>
<listener class="org.hibernate.lucene.event.LuceneEventListener"/>
</event>
<event type="post-commit-insert">
<listener class="com.fcl.util.HibernateEventListener"/>
<listener class="org.hibernate.lucene.event.LuceneEventListener"/>
</event>
<event type="post-commit-delete">
<listener class="com.fcl.util.HibernateEventListener"/>
<listener class="org.hibernate.lucene.event.LuceneEventListener"/>
</event>
(I'm using Lucene to add searchability)
My own code is in com.fcl.util.HibernateEventListener.
The 3 post-commit-? events are firing - I can my logging statements in the log, but
the pre-update event is not being fired. My listener (only the method I'm talking about shown) looks like this:
Code:
public class HibernateEventListener implements PostDeleteEventListener,
PostInsertEventListener, PreUpdateEventListener, PostUpdateEventListener, Initializable
{
...
public boolean onPreUpdate(PreUpdateEvent event)
{
final Object entity = event.getEntity();
System.out.println("About to update " + entity);
}
}
I'm planning to implement security and auditing by hooking into this event, so it's going to be a major cornerstone of our application.
Any ideas?