Have an external java application by notified of changes to Entity EJBs in JBoss AS

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-06-05T00:13:26Z Indexed on 2010/06/05 7:42 UTC
Read the original article Hit count: 187

Filed under:
|
|

I'm trying to connect an external application to a JBoss AS container. The external application is a Java application that is currently being notified of changes to database entities through a JMS topic. I've added an EntityLifecycleListener class to all my entities that publishes a serialized (and unwrapped) copy of the entity to the JMS topic.

The problem is that this implementation ignores the transaction boundaries of the JBoss container. For example, the @PostUpdate event can be fire, generating the JMS message for that entity, but the transaction could be rolled back causing the external application to be notified of an invalid change and become unsync'd.

I need my external application to only be notified of successful commits to the database, but I need to be able to publish the entire java POJO to the external application. Is there an official way of doing this?

© Stack Overflow or respective owner

Related posts about java

Related posts about jboss