[hibernate-issues] [Hibernate-JIRA] Created: (ANN-843) Version increment not triggered on @OneToOne property modification having inverse owner

Guenther Demetz (JIRA) noreply at atlassian.com
Tue Jun 9 07:50:14 EDT 2009


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

                 Key: ANN-843
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-843
             Project: Hibernate Annotations
          Issue Type: Bug
    Affects Versions: 3.4.0.GA
         Environment: Hibernate 3.3.1.GA ,    Microsoft SQL Server
            Reporter: Guenther Demetz
            Priority: Minor
         Attachments: Testcase.jar

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





-- 
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