[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6649) One-to-many L2 caching update failed

Lefebvre (JIRA) noreply at atlassian.com
Tue Sep 13 02:00:05 EDT 2011


One-to-many L2 caching update failed
------------------------------------

                 Key: HHH-6649
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6649
             Project: Hibernate Core
          Issue Type: Bug
          Components: caching (L2)
    Affects Versions: 3.6.7
            Reporter: Lefebvre


Hi,
I think I found a defect for the many-to-one association L2 caching update.
I have the mapping below, a parent have childs :

<hibernate-mapping package="xxx">
	<class name="Parent" table="PARENT" select-before-update="true">
		<cache usage="read-write" />
		<id .../>

		<set name="childs" cascade="all-delete-orphan" inverse="true" lazy="true">
            		<cache usage="read-write" />
            		<key column="FK_PARENT" />
            		<one-to-many class="xxx.Child" />
        	</set>
	</class>
	<class name="Child" table="CHILD" select-before-update="true">
		<cache usage="read-write" />
		<id .../>

		<many-to-one name="parent" column="FK_PARENT" cascade="none" not-null="true" />
	</class>
</hibernate-mapping>

// Retreive p1 and p2 objects
Parent p1 = Retreive parent where id=1
Parent p2 = Retreive parent where id=2


Child c1 = Retreive into p1 object child with id=1

c1.setParent(p2)
p2.addChild(c1)

getSession().update(p2);

// Close hibernate session and leave transaction

After that, if retreive p1 and p2, the 2 objects have the child c1 (into database, the FK_PARENT of the CHILD table is 2 -> p2)

Any idea ?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list