[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6865?page=c...
]
Steve Ebersole commented on HHH-6865:
-------------------------------------
I went a slightly different direction than the pull request, in taking this opportunity to
fix an underlying problem (imo). Basically, {{org.hibernate.PessimisticLockException}}
was being used in 2 completely different ways:
# as a jdbc-level exception (converted from {{SQLException}})
# as a higher-level exception, thrown from locking strategies
In the first case it represents a low-level error coming back from the database. In that
latter, its an error relating to an entity.
Essentially I wanted to have {{LockingStrategy}} throw a unified hierarchy of these
"high level lock exceptions". To that end, I introduced
{{org.hibernate.dialect.lock.LockingStrategyException}} with 2 subclassess:
{{org.hibernate.dialect.lock.OptimisticEntityLockException}} and
{{org.hibernate.dialect.lock.PessimisticEntityLockException}}. I would really have liked
to just drop {{org.hibernate.OptimisticLockException}}, but opted for deprecating it at
the moment since it is in the public package namespace (org.hibernate). We can clean that
up later.
Additionally, I would like to move the {{org.hibernate.dialect.lock}} package outside of
the {{org.hibernate.dialect}} package. Maybe {{org.hibernate.lock}} or
{{org.hibernate.engine.lock}}. Not critical, but nice to have at some point.
PessimisticLockException should be thrown when pessimistic read and
write locking strategies fail
-------------------------------------------------------------------------------------------------
Key: HHH-6865
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6865
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.CR6
Reporter: Gail Badner
Assignee: Steve Ebersole
Fix For: 4.0.0.next
Time Spent: 3h 46m
In some cases, when a pessimistic read/write locking strategy fails with SQLException,
Hibernate converts the SQLException to a org.hibernate.JDBCException, but does not wrap
the JDBCException in a org.hibernate.PessimisticLockException.
This affects:
PessimisticReadSelectLockingStrategy.lock(...)
PessimisticReadUpdateLockingStrategy.lock(...)
PessimisticWriteSelectLockingStrategy.lock(...)
PessimisticWriteUpdateLockingStrategy.lock(...)
These methods specifically catch SQLException, convert it to a
org.hibernate.JDBCException, and wrap in a org.hibernate.PessimisticLockException.
If Hibernate does the conversion immediately when the statement fails and throws
JDBCException, then lock(...) does not have the opportunity to catch it and wrap it in a
org.hibernate.PessimisticLockException.
This issue is reproduced in LockTest failures on Oracle.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira