Tatiana Vorobeva wrote:Hm.
I've found these docs: http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/Criteria.html#createCriteria(java.lang.String)
According them:
So, try to use "com.test.Student.school" (where "com.test" = Student's class package) instead of "school"?
P.S.: maybe you know some good docs for learning how to use Criteria? I've started to learn Hibernate and want to read about Criteria.
There wasn't any execution errors in my code, just wanted to know the logic behind this dissimilarity. I found the answer to my original question. It (The Criteria API) returns only the main criteria class until we explicitly tell it to include all entities in the result (unlike HQL). The following line, if added to the criteria, would include other entities as well:
P.S.: You can start with the book "Java Persistence with Hibernate" by Cristian Bauer and Gavin King