Can you switch to stateful session bean? If yes, you can try the following:

1. Have the stateful sesion bean class implements 
javax.ejb.SessionSynchronization interface.

2. Make the database operation transactional, so that in the case of JTA 
rollback the data is not updated in the DB.

2. Within the afterCompletion() notification method, check the transaction 
status (which is passed as argument). If it is true (meaning transaction is 
committed), write your data into the file. Otherwise (meaning rollback), do not 
write your data into the file.

Please note that this is NOT a perfect solution, because the file operation 
within the afterCompltion() can fail.

You need to provide good error logging, so that the system admin can later fix 
the inconsistency manually.

Please check the EJB spec for details.

Hope this helps.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4151739#4151739

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4151739
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to