[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3612) Coarse-Grained Lock

Xavier Dury (JIRA) noreply at atlassian.com
Thu Nov 20 02:21:17 EST 2008


Coarse-Grained Lock
-------------------

                 Key: HHH-3612
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3612
             Project: Hibernate Core
          Issue Type: Improvement
          Components: core
            Reporter: Xavier Dury


Hibernate should allow a cluster of entities to share a single version. An update of any element in the cluster should lock the root element of the cluster.

Take the classic example of Order (root) which have many OrderLines. If Order has a version property, each time an OrderLine is added or removed, its version will increase.
If Orders must also satisfy an invariant saying that the total amount (= sum for each line of price x quantity < MAX_AUTHORIZED_AMOUNT), two users could concurrently modify (update) two different lines and bypass the invariant. If the Order would have been locked by the first user, the second couldn't have committed his changes. The first user can lock the Order with Session.lock(FORCE) but something more declarative would be better.

http://martinfowler.com/eaaCatalog/coarseGrainedLock.html

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list