Hi Ted, Thanks, I added flush then catch the exception, problem gone.
Ted Steen wrote: > > The problem is that the exceptions does not occur at the line > usr.setEmail("[EMAIL PROTECTED]"); // email already used by other > user > the exception occurs when the session is flushed (at the end of the > request) > so my suggestion would be to make an UsrService with a updateUsr(Usr > usr) method that is properly wrapped in a transaction. Then you have > better control when things happen and also, you can catch an exception > coming from the updateUsr(...) service method. > > Personally I would also add a checkIfEmailExists(String email) and use > that in my updateUsr(Usr usr) and throw EmailAlreadyExistsException > when neccecary. > > > -- View this message in context: http://www.nabble.com/T5%3A-proper-handling-of-hibernate-exception--tp15891081p15896736.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]