Quote:
So, u can´t get the List from a HQL senteces. You can do inversely, like this:
from Project p where p.department.id = 1
FYI, select d.projects from Department d where d.id=1 works just fine.
Quote:
DetachedCriteria dc = DetachedCriteria.forClass( Department.class , "dept" )
.createAlias( "projects", "projs" )
.add( Restrictions.eq( "dept.id", new Integer(1) ) );
List r = dc.getExecutableCriteria( session ).list();
r contains list of departments in this case, so it is not a solution either.
I know that I can access list of Projects from Department, but I need criteria object for that query, not results of its execution.