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.  [ 1 post ] 
Author Message
 Post subject: hashCode/equals questions - again
PostPosted: Wed May 18, 2005 8:23 pm 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
Hibernate version: 3.0.3

Can anyone shed some light on how to come up with the correct way to
implement hashCode/equals methods for persistent objects stored
as children in collection of parent objects?

I have a model with some classes containing collections (sets and lists)
of other, polymorphic, objects. Some of these objects have a 'business
key' which depends on relationship (eg. parent/child where the child
uses parent's hashCode/equals in addition to its own properties).

My question is - should I be using the parent's hashCode/equals values
from the parent?

A problem I am encountering is also that due to Hibernate loading of the
objects from the database as a result of dereferening (which is what I
want), some of these objects are being placed in the parent's collection
before the object references are completely resolved, resulting in a NPE.

_________________
Cheers,

Bonny

please don't forget to rate :)


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

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.