Just wondering why I'm not able to catch this Exception?
Just using a pretty standard extended HibernateDaoSupport with a delete method:
This bit of code is buried in my Web Application and when I have two browsers open and one happens to delete a RecipeList item that has already been deleted by the second browser window a StaleObjectStateException gets thrown.Code:public class RecipeListDAO extends HibernateDaoSupport { public RecipeListDAO() { super(); } public void deleteRecipeItem( RecipeList recipe ) { try { getHibernateTemplate().delete(recipe); } catch( StaleObjectStateException ex ) { ex.printStackTrace(); } } }
I'm at my witts end and a Spring noob.
I'm not doing any TransactionProxy AOP stuff in my applicationContext.xml file.
Would you normally expect to be able to catch the StaleObjectStateException at this point using the HibernateTemplate? Or am I seriously missing a concept?
I attempted to go down a level and get a Hibernate Session using getSession() and manually doing the session.delete(recipe) and session.flush commands myself thinking that at a lower level I'd be able to catch the exception... But no luck.
Any Ideas or hints would be most helpful.
Thank you[/code]


Reply With Quote