Does sql query use 2nd level hibernate cache in place of hql.?

71 views Asked by At

Basically I don't have knowledge about it, I just want to clear my doubt. That when we use sql in place hql through hibernate API, will it use 2nd level cache before making query in database.? The reason being I want to utilise my 2nd level cache as much as possible.

1

There are 1 answers

0
Dragan Bozanovic On

No, it will not, because Hibernate cannot track what you fetch in the native query.

HQL will also not utilize it before query execution, but after it, when it starts assembling the entities from the result set.