I would look at 2 things as I mentioned on HipChat yesterday...

1) Hibernate does have some capacity to do what you are expecting.  There
are definitely some limitations to it.  But the idea is called a
"backref".  When building the metamodel for this, Hibernate should inject 2
synthetic backref properties.  One, org.hibernate.mapping.Backref, is meant
to handle the FK.  The other, org.hibernate.mapping.IndexBackref, is meant
to handle the list/map/array index.  It is possible something got screwed
up in modeling this.  So the first thing I would check is whether these
backref synthetic properties are properly built into the metamodel.  If
they are, then we should make sure they are still handled properly in the
persisters.

2) There has recently been a lot of piecemeal rework of delayed operation
handling.  I wonder if those changes might be coming into play.

I'd suggest looking at (1) first.


On Fri, Jan 22, 2016 at 3:37 AM Gunnar Morling <gun...@hibernate.org> wrote:

> 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 <gbad...@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 <gbad...@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 <gun...@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@lists.jboss.org
> >>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >>
> >>
> >
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to