I have a POJO that has relationships with other POJOs. The relationships are marked for eager fetch-ing.
For some of the use cases, i want to turn OFF the eager fetch. So I tried using native SQL with automatic resultset mapping.
This still results in the eager fetching of relationships.
session.createSQLQuery("select * from Organization").addEntity(Organization.class).list() ;//get me only org data
--> This causes the relationships to be fetched as well. How can i turn it off.?
I tried using the Criteria API as well -
Criteria setFetchMode(String associationPath, FetchMode mode)
This doesn't turn OFF eager fetch either.
what should be the FetchMode to turn of EAGER fetch?
FetchMode.EAGER is deprecated. It recommends use of FetchMode.SELECT which actually gets the data in a separate SQL! Now that is not what i require. I want to turn it off.
Any help would be greatly appreciated