Chad Wilson commented on Bug HHH-5732

Is it possible that this change could have caused somewhat spurious updates to be generated when bulk-persisting entities on both sides of a mapped-by? We don't use JPA, but in 4.1.11.Final I've noticed that there are a whole lot of extra ```update CHILD set CHILDKEY = x where ID = y``` updates now when we have a pseudo-XML-mapping like

<class name="Parent" table="PARENT">
    <id name="id" column="ID" type="long"/>
    <map name="children" batch-size="500" cascade="all" inverse="true" access="field">
        <key column="CHILDKEY"/>
	<map-key-many-to-many column="CHILDKEY" class="ChildKey"/>
	<one-to-many class="Child"/>
    </map>
</class>

<class name="Child" table="CHILD">
    <id name="id" column="ID" type="long"/>
    <natural-id>
        <many-to-one name="key" column="CHILDKEY" class="ChildKey" fetch="join" not-null="true"/>
    </natural-id>
    <many-to-one name="parent" cascade="none" column="PARENT" class="Parent"/>
</class>

So for two parents with two children each we see

insert into PARENT (ID) values (P1);
insert into PARENT (ID) values (P2);
insert into CHILD (ID, CHILDKEY, PARENT) values (C1, K1, P1);
insert into CHILD (ID, CHILDKEY, PARENT) values (C2, K2, P1);
insert into CHILD (ID, CHILDKEY, PARENT) values (C3, K3, P2);
insert into CHILD (ID, CHILDKEY, PARENT) values (C4, K4, P2);
update CHILD set CHILDKEY=K1 where ID=C1; -- didn't do this in 4.1.10.Final
update CHILD set CHILDKEY=K2 where ID=C2; -- didn't do this in 4.1.10.Final
update CHILD set CHILDKEY=K3 where ID=C3; -- didn't do this in 4.1.10.Final
update CHILD set CHILDKEY=K4 where ID=C4; -- didn't do this in 4.1.10.Final

Is this an unavoidable side-effect of this fix? Or possibly something we need to address in our mapping?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira