Ok, no problem, but it's basic code.
Here are the annotations (inside an Entity Bean).
I know this is kinda bad design, but I need it to 'block' an update (some kind of manual-dynamic cascade-implementation).
Code:
@PreUpdate
protected void doPreUpdate()
{
this.blockParentAccess = true;
}
@PostUpdate
protected void doPostUpdate()
{
this.blockParentAccess = false;
}
Then, here's my persistence.xml
Code:
<persistence-unit name="myPersistence">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/myPersistenceDatasource</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/myPersistenceEntityManagerFactory"/>
<!-- use a file system based index -->
<property name="hibernate.search.default.directory_provider"
value="org.hibernate.search.store.FSDirectoryProvider"/>
<property name="hibernate.search.default.indexBase"
value="/etc/tumboliaIndexes"/>
<property name="hibernate.ejb.event.post-insert"
value="org.hibernate.search.event.FullTextIndexEventListener"/>
<property name="hibernate.ejb.event.post-update"
value="org.hibernate.search.event.FullTextIndexEventListener"/>
<property name="hibernate.ejb.event.post-delete"
value="org.hibernate.search.event.FullTextIndexEventListener"/>
</properties>
</persistence-unit>
So, what happens is:
The @PreUpdate method gets called, but the @PostUpdate one doesn't, except if I remove the 'hibernate.ejb.event.post-update' listener from the Hibernate config.
I've been reading that one must be careful with event-listener overriding, that it's better to add it to the listener-list, instead of replacing them, but I don't have a clue how or where to do this.
Help is welcome.
b.[/code]