I'm working with a table containing 17 records.
Using session.createCriteria(MyTable.class).list()
, it returns only 6 records;
Using session.createQuery("from MyTable")
, it returns all records.
The same to .createSQLQuery("SELECT * FROM MY_TABLE").list
.
I really don't know what i'm missing.
Oh, and i'm using Hibernate 4.2.2 directly. No Spring or any framework.
Hibernate created a query with a inner join. I was missing to configure Fetch.LAZY
on the mapping.
U need to look up at the Lazy Loading Concepts and ya U can give Configuration of Lazy loading then Hibernate will Load All the Records as need into the System.