The answer to your question is No, you can't make more than one join to a table using the Criteria API. You'll get a duplicate association path error when you attempt to execute your query.
I managed to get around this by using subqueries. I have a contact association table in my system which holds references to every different type of contact which can be associated with an order (shipping company, billing company, sales rep, etc...).
I used Detached criteria to accomplish this.
Code:
Criteria crit = session.createCriteria(InsertionOrder.class);
DetachedCriteria srCrit = DetachedCriteria.forClass(InsertionOrderContact.class);
Then I add my restrictions to my detached criteria object:
Code:
srCrit.setProjection(Projections.distinct(Projections.projectionList().add(Projections.property("insertionOrder.id"))));
srCrit.add(Restrictions.eq("individualRole.code","SR"));
srCrit.add(Restrictions.eq("primarySrFl","1"));
srCrit.add(Restrictions.in("individual.id",PDSUtils.makeLongArray(temp)));
Finally, I add my detached criteria object as a subquery to my main criteria object:
Code:
crit.add(Subqueries.propertyIn("id",srCrit));
I do this up to 4 different times for that one class (InsertionOrderContact.class).
Hope this helps. Good luck.