Criteria criteria = this.getSession().createCriteria(Competition.class, "b"); DetachedCriteria categoryCriteria = DetachedCriteria.forClass(Category.class, "c"); categoryCriteria.add(Property.forName("c.code").eqProperty("b.subject")); categoryCriteria.add(Restrictions.eq("state", true)); criteria.add(Subqueries.exists(categoryCriteria.setProjection(Projections.property("c.identifier"))));