users@glassfish.java.net

Exceptions and Transactions

From: <glassfish_at_javadesktop.org>
Date: Wed, 09 Apr 2008 04:47:29 PDT

Hi,

It would be nice if someone could help me understand this thing with application exceptions and transactions. I thought I got it but now I cannot really figure it out.

I have a method that parses a string and find references to entities in this string which will be replaced by the names of the entities in the string. There might be references in this string that are invalid and will cause an javax.persistence.EntityNotFoundException when trying to look them up. In this case the method will not replace the reference in the string but it should continue processing the string and finally commit the transaction.

How do I do this? EntityNotFoundException will mark the transaction for rollback even if I do catch it... I have set EntityNotFoundException as an ApplicationException in the ejb-jar.xml but it doesn't seem to help since I would like automatic rollback when it's not caught...

Thank you very much for any assistance!
[Message sent by forum member 'woel' (woel)]

http://forums.java.net/jive/thread.jspa?messageID=268315