I have defined this Entity class, but it does not seem to save the children to the database. Any ideas?
@Entity
public class CategoryModel implements Model<CategoryModel>, Serializable {
private static final long serialVersionUID = -4520507504770029807L;
@Id
@Field(index = Index.UN_TOKENIZED, store = Store.NO)
private String id;
@NotNull
private String name;
@ManyToOne
private CategoryModel parent;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "parent")
private List<CategoryModel> children;
public List<CategoryModel> getChildren() {
return children;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public CategoryModel getParent() {
return parent;
}
public void setChildren(List<CategoryModel> children) {
this.children = children;
}
public void setId(String id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setParent(CategoryModel parent) {
this.parent = parent;
}
}
Many thanks, Finbarr