Yes, Josh - consider especially the situation Christian explained that if
you merge Xy onto a session you expect the returning object is Xy and not
Xx.
If you want this behavior (which in some cases I can see the usefullness
of) you need to have
a custom merge implementation as you already
Thanks, Emmanuel. I'll ponder that tonight. And I'll try to convince
myself that being consistent with saveOrUpdate is a good thing for
merge, but I'm not hopeful. ;)
Cheers,
Josh.
Emmanuel Bernard wrote:
No I mean saveOrUpdate
Think about how saveOrUpdate works in your case, and you will
No I mean saveOrUpdate
Think about how saveOrUpdate works in your case, and you will see that
merge is very consistent.
Josh Moore wrote:
Emmanuel, do you mean saveOrUpdateCopy? Since saveOrUpdate doesn't do
any copying of the values onto another instance.
By the way, the "dirtying" of the n
On Sep 27, 2006, at 8:48 PM, Josh Moore wrote:
copies _invalid_ values on top of the clean proxied collection, and
sends that back to the user.
It does so because you applied these values. Don't do that if you
don't want it. Thanks to Hibernate your mistake will not end up in
the databas
Emmanuel, do you mean saveOrUpdateCopy? Since saveOrUpdate doesn't do
any copying of the values onto another instance.
By the way, the "dirtying" of the non-updatable field I described also
holds for collections. This means that DefaultMergeEventListener does a
source.load(), gets a fully vali
On Sep 27, 2006, at 6:43 PM, Emmanuel Bernard wrote:
This is consistent with the way saveOrUpdate works
And it's perfectly reasonable behavior. If I modify a field value,
then merge, then take the instance returned by merge, I expect that
the value is still there in the merged result. Tha
This is consistent with the way saveOrUpdate works
Josh Moore wrote:
Using Hibernate with non-updatable fields can leave entities in a
confused state.
Take an Image with a field creationEvent, not updatable. If
Image.creationEvent is set on an instance and passed to session.merge(),
then:
(1)
Using Hibernate with non-updatable fields can leave entities in a
confused state.
Take an Image with a field creationEvent, not updatable. If
Image.creationEvent is set on an instance and passed to session.merge(),
then:
(1) Properly, no UPDATE is issued.
(2) DefaultMergeEventListener.copy