[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-6125) Hibernate Criteria.setLockMode have unexpected behaviour when used in conjunction with MySQL

Steve Ebersole (JIRA) noreply at atlassian.com
Fri Mar 16 11:04:48 EDT 2012


     [ https://hibernate.onjira.com/browse/HHH-6125?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-6125.
-------------------------------

    Resolution: Duplicate

> Hibernate Criteria.setLockMode have unexpected behaviour when used in conjunction with MySQL
> --------------------------------------------------------------------------------------------
>
>                 Key: HHH-6125
>                 URL: https://hibernate.onjira.com/browse/HHH-6125
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.6.2
>         Environment: Hibernate 3.6.2, MySql 5.1
>            Reporter: Eric Poitras
>            Priority: Minor
>         Attachments: TestHibernate.java
>
>
> You expect hibernate to issue a select ... for update when issuing a Criteria of this form:
> // This fails
> Criteria c = s.createCriteria(SampleEntity.class);
> c.setLockMode( LockMode.PESSIMISTIC_WRITE );
> SampleEntity e = (SampleEntity) c.uniqueResult();
> But the MySQL dialect class simply ignore the lock mode per alias since MySQL does not support a per-table locking strategy. However, in the previous case, 
> it should issue a for update since we access ALL query tables in update.
> Also, since pessimistic lock may be critical for some process synchronization, it should AT LEAST not silently fail.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list