Has anyone successfully run this example using Hibernate 3.1.2 and MySQL 5? I got into a big stink with the Hibernate folks over this example: http://blog.hibernate.org/cgi-bin/blosxom.cgi/Steve%20Ebersole/deadlocks.html
The issue essentially is this: GenerateDeadlock does not behave as the authors would lead you to believe. There are 2 missing ingredients, 1. serializable transaction isolation level (which can be set globally in hibernate.properties or in the code), and 2. calling flush() after step1() and step2(). Even after adding these the code is still not catching a HibernateException on deadlock, instead a "lock wait timeout" exception is thrown. This implies that the DB is not throwing a deadlock exception, something which should not be because I'm using INNODB which supposedly is ACID compliant. The Hibernate folks are refusing to be helpful because they describe this as "bogus", "silly", "nonsense". If it's so trivial to get this example working correctly you'd think they wouldn't be put out over helping. Perhaps it's really not so trivial. At any rate if anyone has successfully run GenerateDeadlock with the above 2 additions against MySQL 5 I'd like to hear from you. Those interested in trying the code examples from "Pro Hibernate 3" can go to www.apress.com and download the zip file.
The issue essentially is this: GenerateDeadlock does not behave as the authors would lead you to believe. There are 2 missing ingredients, 1. serializable transaction isolation level (which can be set globally in hibernate.properties or in the code), and 2. calling flush() after step1() and step2(). Even after adding these the code is still not catching a HibernateException on deadlock, instead a "lock wait timeout" exception is thrown. This implies that the DB is not throwing a deadlock exception, something which should not be because I'm using INNODB which supposedly is ACID compliant. The Hibernate folks are refusing to be helpful because they describe this as "bogus", "silly", "nonsense". If it's so trivial to get this example working correctly you'd think they wouldn't be put out over helping. Perhaps it's really not so trivial. At any rate if anyone has successfully run GenerateDeadlock with the above 2 additions against MySQL 5 I'd like to hear from you. Those interested in trying the code examples from "Pro Hibernate 3" can go to www.apress.com and download the zip file.