[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2320) Regression: optional properties under a <join> tag no longer update properly

Chris Jones (JIRA) noreply at atlassian.com
Wed Dec 20 18:30:04 EST 2006


Regression: optional properties under a <join> tag no longer update properly
----------------------------------------------------------------------------

         Key: HHH-2320
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2320
     Project: Hibernate3
        Type: Bug

  Components: core  
    Versions: 3.2.1, 3.2.0.cr4, 3.2.0.ga, 3.2.0.cr5    
 Environment: hibernate 3.2.0.cr4 through 3.2.1.ga
hsql 1.8.0.7 and Oracle 9i

    Reporter: Chris Jones


This was specifically introduced with the revision 10217 changes on the 3.2 branch in src/org/hibernate/persister/entity/AbstractEntityPersister.java

Given the following setup:

<class name="Thing">
  <id .../>
  <join table="JOIN_TABLE" optional="true">
    <key column="THING_ID" not-null="true"/>
    <property name="joinedProperty" column="JOINED_PROPERTY"/>
  </join>
</class>

scenario:
Thing thing1 = new Thing();
thing1.setJoinedProperty("thing1");
save(thing1);
// a record in the JOIN_TABLE is created properly and updates on the property can occur

Thing thing2 = new Thing();
thing2.setJoinedProperty(null);
save(thing2);
// no record in JOIN_TABLE is created

thing2.setJoinedProperty("thing2");
save(thing2);
// in revision 10216, hibernate correctly runs an INSERT to create a JOIN_TABLE record with the value "thing2"
// in revision 10217, hibernate incorrectly runs an UPDATE to try and update a non-existant record in the JOIN_TABLE with the thing2 id

It looks like the expectation.verifyOutcome() method should be throwing a StaleStateException if the attempted update effects 0 rows.

I will try and get an official hibernate testcase going and possibly a patch, but I wanted to enter this now in case there is something I'm missing that makes this change in functionality intentional.


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