[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5275?page=c...
]
Chad Wilson commented on HHH-5275:
----------------------------------
To confirm for others, this is still an issue in 3.6.8.Final.
Only the second patch by Jakob worked for me for both "for update" and aliased
"for update of" cases. While Jakob's advice from his Oracle expert is
correct in the single table query case, proper "for update *of*" syntax is often
important when you are joining multiple tables as it allows you to only lock the row in
one or more of the tables, rather than *all* rows from various tables. In other words,
"for update" *without* "of" will lock all rows in all tables involved
in the select.
Worth noting that none of the fixes will make 'for update of' work with
result-limited queries though; You'll always get "ORA-00904:
"THIS_"."ID": invalid identifier" types of errors. This is due to
HHH-2844 / HHH-759 making it generate invalid queries like
{code}select * from (select this_.ID from MY_TABLE as this_) where rownum <= 1 for
update of this_.ID{code}
Criteria.setLockMode does not work correctly
--------------------------------------------
Key: HHH-5275
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5275
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.2, 3.5.3
Environment: Hibernate 3.5.2, Oracle 10 (using
org.hibernate.dialect.Oracle10gDialect
Reporter: Björn Moritz
Priority: Minor
Attachments: AnotherOracle10gDialect.java, My_Oracle10Dialect.java,
My_Oracle10Dialect.java, TestCase.zip
The LockMode set via Criteria.setLockMode does not generate a ' for update' SQL
statement. In the org.hibernate.dialect.Dialect class only the LockOptions are used for
determining a possible addition to the SQL statement if using pessimistic locking. This
behaviour is different from Hibernate 3.1.3.
In the supplied TestCase two threads are reading the same database record; one of those
threads should use pessimistic locking thereby blocking the other thread. But both threads
can read the database record causing the test to fail.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira