[jboss-user] [JBoss Seam] - Re: Exception handling of PersistenceException

dapeng do-not-reply at jboss.com
Tue Nov 13 15:11:55 EST 2007


Hi, Pete, 


I've got the following case. A method (no conversation) will be called to delete a row in the database. The backing bean method returns without error, because the flush is not occured at this time. Later the SeamPhaseListener commits the first tx, which flushes the persistence context. During the flush a ConstraintViolationException is thrown because of a foreign key constraint exception. But my application code has no chance to catch this exception, because the backing bean method has finished already. 

The only possibility is to write a complex error handling, which is able to do something after the tx commit. I have 2 problems here.
1. Currently SpringTransaction swallows the cause exception, so that I can't find the ConstraintViolationException in the exception stack. I will switch to another trnasaction manager and sees whether it is cleaner.
2. The exception handling mechanism doesn't allow me to hook in user defined exception handler, so that I can check the exception stack, so some logic. I think the redirect, end-conversation and http error are not enoughj under all circumstances.

Like to know your opinion.

Dapeng


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104301



More information about the jboss-user mailing list