[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5654?page=c...
]
Eitan Suez commented on HHH-5654:
---------------------------------
we tried out upgrading from hibernate 3.3.x to 3.5.x and even 3.6.x and had to abandon the
upgrade because of this bug. we're running postgresql 8.4.4, transitioning to
postgresql 9.
query.setLockMode("alias",
LockMode.LockMode.PESSIMISTIC_WRITE); does not Lock in PostgreSqlDialect
---------------------------------------------------------------------------------------------------
Key: HHH-5654
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5654
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.5
Environment: Hibernate 3.5.5-Final
PostgreSQL 8.4
Reporter: Peter Buning
When you call
{{query.setLockMode("alias", LockMode.PESSIMISTIC_WRITE);}}
you get a Query with a LockOptions object that has lockMode = LockMode.NONE and a
aliasSpecificLockModes-map with an entry "alias" ->
LockMode.PESSIMISTIC_WRITE
When calling {{query.list()}} you get to the QueryLoader which calls
{{dialect.applyLocksToSql(...)}}
The LockOptions-Object has still lockMode=LockMode.NONE and a aliasSpecificLockModes-map
with the translated alias and -> LockMode.PESSIMISTIC_WRITE
As we use PostgreSQL dialect is an instance of PostgreSQLDialect.
So you get a ForUpdateFragement-object with the same LockOptions-object. The
aliases-String contains the translated "alias".
In {{toFragmentString()}} {{getForUpdateString(String aliases, LockOptions
lockOptions)}} is called because we have a LockOptions-object. The aliases are ignored in
this case, as you can see in the comment:'by default we simply return the
getForUpdateString() result since the default is to say no support for "FOR UPDATE OF
..."'
But the {{getForUpdateString(LockOptions lockOptions)}} is only looking at the the
lockMode-Attribute of the LockOptions-object what has still the value
"LockMode.NONE". It results in an empty String as the return value. But it
should be " for update" because there's a LockMode.PESSIMISTIC_WRITE in the
aliasSpecificLockModes which is ignored in getForUpdateString(LockOptions lockOptions)
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira