-->
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.  [ 2 posts ] 
Author Message
 Post subject: Collection/Map at Multiple Level
PostPosted: Mon Jan 12, 2004 8:53 am 
Newbie

Joined: Sun Nov 30, 2003 10:09 am
Posts: 14
Hi all,

I have a class X (say) which has a Collection/Map which is supposed to contain objects of class Y. Now class Y has a Collection/Map which is supposed to contain object of class Z. I am giving the dummy code below.

public class X
{
private Map = ymap; // This Map contains object of class Y
public X
{
ymap = new HashMap();
}
public Map getYmap()
{
return this.ymap;
}
public void setYmap(Map map)
{
this.ymap = map;
}

}

public class Y
{
private Map = zmap; // This Map contains object of class Z
public Y
{
zmap = new HashMap();
}
public Map getZmap()
{
return this.zmap;
}
public void setZmap(Map map)
{
this.zmap = map;
}

}
public class Z
{
// Contains its own properties
}

My requirement is..when I save object X, I want the contained Y and Z objects to be persisted simultaneously.Can this be done in Hibernate? If possible pls let me know what shold be the .hbm file for the data structure mentioned above.


With thanks

Banik


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 12, 2004 8:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Set the cascading accordingly: http://www.hibernate.org/hib_docs/reference/html/parent-child.html#parent-child-cascades


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.