users@glassfish.java.net

catching transaction rollback exceptions on container managed beans

From: <glassfish_at_javadesktop.org>
Date: Thu, 11 Sep 2008 10:59:02 PDT

Hi,

i have the following method


        @TransactionAttribute(TransactionAttributeType.REQUIRED)
        public Account createAccount(Account account)
{
try
{
} catch(Throwable th)
{
// throw application specific exception
}
}

some of the attributes of account is not set which has a not null constraint on db side. One way to resolve is to validate the object before persisting. Lets assume that validation is not there, then on return of the method throws transaction rollback exception.

So my question is there any way to catch with in the try catch block of the createAccount() without either making the method to bean managed persistence or by creating DAO kind of layer???

thanks
[Message sent by forum member 'eligetiv' (eligetiv)]

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