Duplicate
Details
Assignee
UnassignedUnassignedReporter
Eric PoitrasEric PoitrasComponents
Affects versions
Priority
Minor
Details
Details
Assignee
Unassigned
UnassignedReporter
Eric Poitras
Eric PoitrasComponents
Affects versions
Priority
Created April 15, 2011 at 3:05 PM
Updated March 16, 2012 at 5:05 PM
Resolved March 16, 2012 at 5:03 PM
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.