0 Replies Latest reply on Apr 23, 2005 4:54 PM by wesleyhall

    Persist and throw exception...

    wesleyhall Newbie

      Hello all,

      I have written a session bean that handles some basic user management functions. The logon function will increment a failed logon counter in an entity and then throw an exception to indicated a failed logon.

      I have been pulling my hair out this evening trying to discover exactly why this increment is not happening when i run my unit tests. Then I suddenly realized that I would probably preventing the transaction from commiting by throwing the exception. I cannot turn transactions off for this method (which wouldnt be a problem) because the entity manager complains that it is being used outside of a transactional context.

      My question... is there a way to both commit the transaction and throw an exception from the method? In this case, this seems like a perfectly legitimate thing to do.

      Thanks

      Wesley Hall