hi,
On Sun, 2 Feb 2003 08:41:22 -0800 (PST), "jiesheng zhang"
<[EMAIL PROTECTED]> said:
>
> I use the Java code instead of Hibernate to keep the
> parent-child relationship.
yeah, that's a very reasonable approach, i just got bogged down in the
beauty of the hibenate <parent> :)
however, even with the simple java based "call child.setParent(this) from
parent.setChild(...)" i'm still experiencing some weirdness that i can't
really explain... i have the same mapping file as quoted previously
(except for <parent> ofkoz, and i chgd the bag to list).
in the nested parent class i have:
protected void setItems(List items) {
this.items = items;
for (Iterator i=items.iterator(); i.hasNext(); ) {
((Item)i.next()).setOrigin(this);
}
}
however, my testcase still fails - the parent is set on the child, but
it's apparently pointing to a different object instance... here's an
excerpt from the testcase:
SubscriptionI loadedSub = ...; // use hibernate to load this
FeedI loadedFeed = loadedSub.getFeed();
assertEquals(loadedSub, loadedFeed.getSubscriptionInfo()); // this is
fine
ItemI item = (ItemI) loadedFeed.getItems().get(0);
assertEquals( loadedFeed, item.getOrigin() ); // !!! this
fails.. not the same instance.. why?!
i would appreciate any thoughts on this - i would like to understand
what's going on :)
thx,
viktor
ps. the full code is available at:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/flock/flock/src/java/net/sf/flock/hibernate/
--
http://fastmail.fm - Choose from over 50 domains or use your own
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel