This content has been marked as final.
Show 3 replies
-
1. Re: Transaction rolled back question
yilmaz_ Nov 16, 2007 10:08 AM (in response to viniciuscarvalho)if an excetion occurs container rollbacks automatically.
if you want to hold the state of transaction use UserTransaction
and this is not a good idea to catch exceptionstry{...}
catch(SQLEXception e){
throw new RuntimeException(e);//softening the exception
}
can you publish dao.recordError(messageID); methods code. -
2. Re: Transaction rolled back question
viniciuscarvalho Nov 16, 2007 11:14 AM (in response to viniciuscarvalho)"yilmaz_" wrote:
if an excetion occurs container rollbacks automatically.
if you want to hold the state of transaction use UserTransaction
and this is not a good idea to catch exceptionstry{...}
catch(SQLEXception e){
throw new RuntimeException(e);//softening the exception
}
can you publish dao.recordError(messageID); methods code.
Well, I've just solved it by changing my app exception to a checked exception. The dao actually throwed an app exception which was an unchecked exception so I could not have to deal with it on every call.
I was really hopping the conteiner would invalidate the exception only if my last call threw it :(
Can't see why my application exceptions can not be descendants of RuntimeExceptions ... -
3. Re: Transaction rolled back question
yilmaz_ Nov 17, 2007 1:06 PM (in response to viniciuscarvalho)if you want to catch exception you can use throw
dao.recordError(messageID);
if recordError method throws an axception you may not catch it. You can use file logging instead of db logging. log4j or slf4j