DetachedCriteria locationdc = DetachedCriteria.forClass(Location.class);
Integer in = new Integer(1);
locationdc.add(Restrictions.eq("xxx", in));
DetachedCriteria roomdc= locationdc.createCriteria("rooms");
roomdc.add(Restrictions.eq("parent_location", unit));Hibernate认为这是right join.所以不加条件是会出现9条记录的。