-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: PersistentBag equalsSnapshot discrepancy
PostPosted: Wed Apr 12, 2017 1:13 pm 
Newbie

Joined: Wed Apr 12, 2017 1:02 pm
Posts: 3
Hello,

I have seen the PersistentBag.equalsSnapshot method implementation is quite different from the other collections, and there is neither any comment nor some change in history for explaining that.

The point is, all other collections (including idbag) EqualsSnapshot methods do check each element current value dirtiness against the snapshot element value, while PersistentBag only check they are "same" (which does a reference equality for entity types). Granted, it needs that check for checking their duplication count is same (bag semantics). But shouldn't it check dirtiness too at some point, as all other collections do?

I find such discrepancy suspect, especially since nothing seems to explain it.

In fact, I have seen that first on NHibernate side, and now see it is there in Hibernate too.

Does anyone knows a good reason for this?

Best regards.


Top
 Profile  
 
 Post subject: Re: PersistentBag equalsSnapshot discrepancy
PostPosted: Wed Apr 12, 2017 1:42 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1638
Location: Romania
I think it's because of the Bag semantics which makes no guarantees about the objects being stored. However, I don't know why this algorithm was chosen. It would be worth to ask the question on the Hibernate mailing list.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: PersistentBag equalsSnapshot discrepancy
PostPosted: Wed Apr 12, 2017 2:14 pm 
Newbie

Joined: Wed Apr 12, 2017 1:02 pm
Posts: 3
Thanks for your insights,

I have posted a message to development mailing list now.

I have also quickly checked current documentation on bags, it does not look like this lack of guarantees is clearly documented.

Anyway, I think this discrepancy may mainly impact the collection holder entity version increment behavior when it has a version, and eventually may impact Envers events logging too. I mean, a change of the state of an entity in a bag would not cause the entity holding the bag to get its version incremented or envers auditing a change, while with a set or idbag it would. So nothing very bad, but may be surprising.


Top
 Profile  
 
 Post subject: Re: PersistentBag equalsSnapshot discrepancy
PostPosted: Wed Apr 12, 2017 5:46 pm 
Newbie

Joined: Wed Apr 12, 2017 1:02 pm
Posts: 3
Well, my message was rejected. My mail is not authorized to post to it. If I was supposed to find a user mailing list, not the dev one, then I did not found it.


Top
 Profile  
 
 Post subject: Re: PersistentBag equalsSnapshot discrepancy
PostPosted: Thu Apr 13, 2017 12:55 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1638
Location: Romania
It works best with GMail. Even with Yahoo there were some issues.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.