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 :)
|
|