<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Thinking inside a bigger box - Latest Comments in What you didn&amp;#8217;t think you needed to know about hashCode and equals</title><link>http://thinkinginsideabiggerbox.disqus.com/</link><description></description><atom:link href="https://thinkinginsideabiggerbox.disqus.com/what_you_didnt_think_you_needed_to_know_about_hashcode_and_equals/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 04 Nov 2008 02:00:39 -0000</lastBuildDate><item><title>Re: What you didn&amp;#8217;t think you needed to know about hashCode and equals</title><link>http://johannesbrodwall.com/2008/11/02/what-you-didnt-think-you-needed-to-know-about-hashcode-and-equals/#comment-3469082</link><description>&lt;p&gt;I've never had much luck with the precreated keys. But then again, I use the convention of a null-key to indicate unsaved objects, so I'd run into other problems. FWIW, it sounds like your approach would behave correctly.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Johannes Brodwall</dc:creator><pubDate>Tue, 04 Nov 2008 02:00:39 -0000</pubDate></item><item><title>Re: What you didn&amp;#8217;t think you needed to know about hashCode and equals</title><link>http://johannesbrodwall.com/2008/11/02/what-you-didnt-think-you-needed-to-know-about-hashcode-and-equals/#comment-3453716</link><description>&lt;p&gt;rzei raises a valid point regarding changing fields. What is your advice regarding the implementation of hashcode()? Is the only way to compute and persist some kind of unchangeable UID for each object?&lt;/p&gt;&lt;p&gt;In a framework I have used, persistent keys were (wastefully) created with the object, so even if the object would never be persisted, it still had a PK. So one could use the PK in hashcode implementations.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jakob</dc:creator><pubDate>Mon, 03 Nov 2008 07:15:44 -0000</pubDate></item><item><title>Re: What you didn&amp;#8217;t think you needed to know about hashCode and equals</title><link>http://johannesbrodwall.com/2008/11/02/what-you-didnt-think-you-needed-to-know-about-hashcode-and-equals/#comment-3453629</link><description>&lt;p&gt;I agree that too few posts have been written on this subject. I've come into problems with equals/hashCode and persistance serveral times, but I haven't found very much useful info on the topic.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tomas</dc:creator><pubDate>Mon, 03 Nov 2008 07:02:17 -0000</pubDate></item><item><title>Re: What you didn&amp;#8217;t think you needed to know about hashCode and equals</title><link>http://johannesbrodwall.com/2008/11/02/what-you-didnt-think-you-needed-to-know-about-hashcode-and-equals/#comment-3453293</link><description>&lt;p&gt;Hi, rzei&lt;/p&gt;&lt;p&gt;The example wasn't very clear. I've run into the the problem in the following situations: I have a Parent object that includes many Children in a HashSet. I construct a new Parent and add Children to it, then I persist the Parent for the first time, and the HashSet is configured persisted as well, through cascading.&lt;/p&gt;&lt;p&gt;The result is that the Child objects are given an id, their hashCode change, and I can no longer find them.&lt;/p&gt;&lt;p&gt;Hope this was clearer?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Johannes Brodwall</dc:creator><pubDate>Mon, 03 Nov 2008 06:03:01 -0000</pubDate></item><item><title>Re: What you didn&amp;#8217;t think you needed to know about hashCode and equals</title><link>http://johannesbrodwall.com/2008/11/02/what-you-didnt-think-you-needed-to-know-about-hashcode-and-equals/#comment-3453105</link><description>&lt;p&gt;From a Hibernate users standpoint, could you give an example of a situation where you need to store a hashset of objects of which some are persisted, some get persisted why stored in set and some do not?&lt;/p&gt;&lt;p&gt;If you declare that id shouldn't be used in hashCode; in the same way you could say that you cannot use any fields in hashCode, as every one of those can change.&lt;/p&gt;&lt;p&gt;Surrogate should be the most stable property of an persist entity as it changes only once.&lt;/p&gt;&lt;p&gt;Great post though, too few have been written on the subject.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rzei</dc:creator><pubDate>Mon, 03 Nov 2008 05:26:12 -0000</pubDate></item></channel></rss>