Looking
viewtopic.php?p=2383408to solve one of my current problems with hibernate not behaving properly I think I found
a very nasty flow in the way hibernate session is caching retrieved information under some
special circumstances
Lets assume I have the following statements in my code which (supposedly) allow me to
implement a certain form of row locking for DB like MySQL MyISAM storage engine which do not have
this functionality by default
String lockStr = "SELECT GET_LOCK('" + c + "_" + id + "',5)";
SQLQuery qq = sqlQuery(lockStr);
List<Object[]> res = qq.list();
wouldn't the session cache give me twice the same result (1 in this case) in 2 threads meaning they both got the lock
whereas the 1st thread should clearly get 1 and the second 0 ???