Hibernate Criteria Join with 3 Tables
The fetch mode only says that the association must be fetched. If you want to add restrictions on an associated entity, you must create an alias, or a subcriteria. I generally prefer using aliases, but YMMV: Criteria c = session.createCriteria(Dokument.class, “dokument”); c.createAlias(“dokument.role”, “role”); // inner join by default c.createAlias(“role.contact”, “contact”); c.add(Restrictions.eq(“contact.lastName”, “Test”)); return c.list(); This … Read more