I have a table in my Oracle database with child parent relationship like -
What I need is to access the list of child in hierarchical manner in Hibernate.
- When Father logs in - he gets Son as child.
- When Grandfather logs in - he gets Son, Father, Uncle.
- When Super Grandfather logs in - he gets Son, Father, Uncle and Grandfather.
I have a java entity for same as well.
public class relations {
private String child;
private String parent;
public getChild();
public getParent();
public setChild();
public setParent();
}
How to run a recursion over this?
Should I be doing it by writing a named query in SQL for getting the list or it can be implemented in java hibernate?
What I am looking for is to write a recursive code in java. Thanks in advance.
See Question&Answers more detail:os