java - Hibernate - Recursive query to get object by level -


i have question hibernate recursive get. have class:

public class person {     private int personid;     private set<person> relations = new hashset<person>(0); 

friends of level x of person defined below: - if x = 1, friends of level x of person have direct relation - if x > 1, friends of level x of friends of friend of level (x-1) of a.

exemple: - have 3 friend a1, a2, a3 - a1 have 2 friends a1.1 , a1.2 - a2 have 1 friends a2.1 - a3 doesn't have friend except --> a1.1, a1.2 , a2.1 friends of level 2 of a

the question is: use hql or sql or criteria find relation of level x of a.

thanks suggestion :-)


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -