Hibernate XML mapping file:
Mapping java class:
public class Catalogue {
private int id;
private String content;
private Catalogue parent;
private Set<Catalogue> children =
new HashSet<Catalogue>();
public Parent(){
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Set<Catalogue> getChildren() {
return children;
}
public void setChildren(Set<Catalogue> children){
this.children = children;
}
public void addChild(Catalogue child){
child.setParent(this);
children.add(child);
}
public String getParent() {
return parent;
}
public void setParent(Catalogue parent) {
this.parent = parent;
}
}
No comments:
Post a Comment