Hi Gail,
Also with that PR I am still seeing the extra updates during insert.
Regarding merging, which case exactly do you mean? If I add another
element to the Parent#children association, I see INSERT+UPDATE for
that, too. Is it that what you mean?
--Gunnar
2016-01-21 22:50 GMT+01:00 Gail Badner <gbadner(a)redhat.com>:
Actually, that pull request will only affect merging transient
entities. Are
you seeing the extra updates when merging?
On Thu, Jan 21, 2016 at 1:09 PM, Gail Badner <gbadner(a)redhat.com> wrote:
>
> Hi Gunnar,
>
> Can you try using this pull request for HHH-9979 [1] to see if the extra
> updates go away?
>
> This pull request is already closed because I am going to use new
> OperationContext functionality to fix HHH-9979. I know this pull request
> does get rid of some updates, and the future one will as well.
>
> Thanks,
> Gail
>
> [1]
https://github.com/hibernate/hibernate-orm/pull/1067
>
>
> On Thu, Jan 21, 2016 at 3:25 AM, Gunnar Morling <gunnar(a)hibernate.org>
> wrote:
>>
>> Steve, all,
>>
>> I have a model with two entities, Parent and Child, and an
>> unidirectional one-to-many association from the former to the latter.
>>
>> Via @JoinColumn on the association it is ensured that the Parent FK is
>> stored in the Child table, i.e. without a separate join table. When
>> inserting a Parent and several Child entities, I see the following
>> statements:
>>
>> INSERT INTO parent (id, name) VALUES (?,?)
>>
>> INSERT INTO child (id, childname) VALUES (?,?)
>> INSERT INTO child (id, childname) values (?,?)
>>
>> UPDATE CHILD SET Parent_id=? WHERE id=?
>> UPDATE CHILD SET Parent_id=? WHERE id=?
>>
>> Why is it that the FK is propagated through separate updates instead
>> of doing it as part of the Child insert?
>>
>> Thanks,
>>
>> --Gunnar
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
>