From: Matthias G. (JIRA) <no...@at...> - 2006-07-08 12:21:57
|
LockMode.UPGRADE does not work for get(), load() and refresh() on SQL Server ---------------------------------------------------------------------------- Key: HHH-1889 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1889 Project: Hibernate3 Type: Bug Components: core Versions: 3.2.0.cr2, 3.2.0.cr3 Environment: Windows XP, Hibernate 3.2.cr3 Reporter: Matthias Germann Priority: Critical Passing a LockMode parameter to the get(), load() or refresh() method of the Session class has no effect on MS SQL Server. The statement session.load(ProcessInstance.class, 33l, LockMode.UPGRADE) produces this SQL Statement with the SQLServerDialect: select processins0_.ID_ as ID1_20_0_, processins0_.VERSION_ as VERSION2_20_0_, processins0_.START_ as START3_20_0_, processins0_.END_ as END4_20_0_, processins0_.ISSUSPENDED_ as ISSUSPEN5_20_0_, processins0_.PROCESSDEFINITION_ as PROCESSD6_20_0_, processins0_.ROOTTOKEN_ as ROOTTOKEN7_20_0_, processins0_.SUPERPROCESSTOKEN_ as SUPERPRO8_20_0_ from JBPM_PROCESSINSTANCE processins0_ where processins0_.ID_=? This Statement does not contain the requested locking hint. The FROM claus should look like this: from JBPM_PROCESSINSTANCE processins0_ with (updlock, rowlock) The OracleDialect produces a correct statement with a FOR UPDATE clause select processins0_.ID_ as ID1_20_0_, processins0_.VERSION_ as VERSION2_20_0_, processins0_.START_ as START3_20_0_, processins0_.END_ as END4_20_0_, processins0_.ISSUSPENDED_ as ISSUSPEN5_20_0_, processins0_.PROCESSDEFINITION_ as PROCESSD6_20_0_, processins0_.ROOTTOKEN_ as ROOTTOKEN7_20_0_, processins0_.SUPERPROCESSTOKEN_ as SUPERPRO8_20_0_ from JBPM_PROCESSINSTANCE processins0_ where processins0_.ID_=? for update The lock() method works correctly. IMHO, the problem is that only the SimpleSelect class uses the appendLockHint() method of the Dialect class. The Select class does not seam to use the appendLockHint() method. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |