Hello,
can you give me a short example on how to map a one-to-many relationship between two classes. The "many" classes are stored in a map in the "one" class and therefore I don't know how to map this. The two classes:
Code:
public class Parent {
private Map childs = new HashMap();
private int id;
...
public void setChilds(Map childs) {
this.childs = childs;
}
public Map getChilds() {
return this.childs;
}
}
Code:
public class Child {
private String name;
private int id;
...
}
I want to use the name of each child as key for the map and the object itself as value. I'd only seen examples which using not objects as elemnts. I'am using one table per class.
Thank you.
Regards