Just an opinion, but you really need to move from thinking about db joins to thinking in terms of objects. You don't really show your object fields or relationships, but let's say that Item has a members field that holds a set of WorkspaceMember objects and WorkfspaceMember has a trustees member that holds a set of Trustee objects.
One approach would be to query in HQL, something like this:
"SELECT * FROM Item WHERE members.trustees.trusteeID = :tid"
Another approach would be to use Criteria, adding the path. Something like this:
Criteria c = session.createCriteria(Item.class)
.createAlias("members", "member")
.createAlias("trustees", "trustee")
.add(Restriction.eq("member.trustee.trusteeID", id);
Just take a look at the doc on the Criteria interface for examples.
|