By searching a little I realized that there are some ways to make a Join using criteria.
One of them is using an alias and one using a root.
How to do the query below in Criteria using the 2 forms and which of the two would be the best (best in relation to performance)?
Select c.id from entidade c inner join entidade2 e where c.id=e.idC;
Does anyone know of a site with beautiful documentation regarding Criteria and Joins?
I know a way to do but returns the entire entity and it's not quite the way I want it because I want only the entity's id.
Criteria c = session.createCriteria(Entidade.class, "C");
c.createAlias("C.entidades1", "e");
c.add(Restrictions.eq("c.id", "e.idC"));
c.list();