well yes there is, Off the bat here we go ...
so you've got say an ASSOCIATE table which goes like this:
Run an alter table by adding foreign key constraint ... PARENT_ID references ASSOCIATE(ID). PARENT_ID for ROOT (the CEO of an organization for example, (that would be me for every organization you can imagine
).)
Now, once we are done, we do something like this on ORM end:
Then you basically map according to basic collections mapping ... and do operations ... let me know if you need more elaboration
Trilochan
Addendum:
You don't need anything extra special for this to happen from hibernate criteria, off course since you're only getting IDs, your option is to you AliasToBeanTransformer and transform your so called projection into a custom model. Good luck!