when i use tree model like this:
and then i operate the domain like this:
mongodb will use dbref to save the relationship of parent object and children.
if query parent by id. program will throws stack overflow error. i guess that is the @dbref injection in cycle.
so, how can i resolve this problem?
Code:
@DBRef
private Menu parent;
@DBRef
private List<Menu> children = new ArrayList<Menu>();
Code:
Menu parent = menuService.find(parent);
child.setParent(parent);
child = menuService.upsert(child);
parent.addChild(child);
menuService.upsert(parent);
if query parent by id. program will throws stack overflow error. i guess that is the @dbref injection in cycle.
so, how can i resolve this problem?