@CommitAfter and HibernateExceptions
Hi, i am learning how to use the @CommitAfter annotation, but i want to catch the exception when the database does not allows to delete a record and thus to show the user a friendly messages like X can't be deleted, check if it is not being in use in Z, or other messages based on the hibernateException thrown. The case is that when i do XDAO.delete(X) in the page method onActionFromDelete annotated with @CommitAfter, hibernate does not actually delete the record at this moment, instead is scheduled for deletion, so the deletion is attempted when the commit method is called, but this is not doit inside my action method so i can't catch it. I don´t want to do this checks manually because de database is doing this job for me (may be i'm too lazy ;). That may be the best approach for this? Thanks César. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @CommitAfter and HibernateExceptions
good question, I like to know too. César Lesc wrote: Hi, i am learning how to use the @CommitAfter annotation, but i want to catch the exception when the database does not allows to delete a record and thus to show the user a friendly messages like X can't be deleted, check if it is not being in use in Z, or other messages based on the hibernateException thrown. The case is that when i do XDAO.delete(X) in the page method onActionFromDelete annotated with @CommitAfter, hibernate does not actually delete the record at this moment, instead is scheduled for deletion, so the deletion is attempted when the commit method is called, but this is not doit inside my action method so i can't catch it. I don´t want to do this checks manually because de database is doing this job for me (may be i'm too lazy ;). That may be the best approach for this? Thanks César. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/%40CommitAfter-and-HibernateExceptions-tp20611252p20612890.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]
Re: @CommitAfter and HibernateExceptions
Try to flush then Hibernate Session. It will make things happen in the database immediately. HTH, Olle 2008/11/21 Angelo Chen [EMAIL PROTECTED] good question, I like to know too. César Lesc wrote: Hi, i am learning how to use the @CommitAfter annotation, but i want to catch the exception when the database does not allows to delete a record and thus to show the user a friendly messages like X can't be deleted, check if it is not being in use in Z, or other messages based on the hibernateException thrown. The case is that when i do XDAO.delete(X) in the page method onActionFromDelete annotated with @CommitAfter, hibernate does not actually delete the record at this moment, instead is scheduled for deletion, so the deletion is attempted when the commit method is called, but this is not doit inside my action method so i can't catch it. I don´t want to do this checks manually because de database is doing this job for me (may be i'm too lazy ;). That may be the best approach for this? Thanks César. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/%40CommitAfter-and-HibernateExceptions-tp20611252p20612890.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] -- Olle Hallin Senior Java Developer and Architect [EMAIL PROTECTED] www.crisp.se