Uploaded image for project: 'Hibernate ORM'
  1. HHH-4289

Version increment not triggered on @OneToOne property modification having inverse owner

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Rejected
    • Affects versions: None
    • Fix versions: None
    • Components: hibernate-core
    • Labels:
      None
    • Environment:
      Hibernate 3.3.1.GA , Microsoft SQL Server
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      In the revised "Java Persistence with Hibernate" book by Christian Bauer and Gavin King on page 464
      there's written following about versioning:

      "If you use Hibernate as JPA provider ... every value-typed property modification .. triggers a version increment."

      Now I saw that Version increment indeed is not triggered on @OneToOne properties having an inverse owner (= mappedBy setted).
      This allows several concurrent transactions to set the association from same object towards different targets without having a OptimistickLockException at commit.
      This violates the ToOne policy! (Hibernate detects the inconsistency later when loading the property from database:
      org.hibernate.HibernateException: More than one row with the given identifier was found)

      Please see attached junit-testcase for reproducing the problem.

      regards
      Guenther Demetz

        Attachments

          Issue links

            Activity

              People

              • Votes:
                8 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: