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
|