How effectively disable the query cache - Lazy Loading problems

Hello,

I am using version 5.3.5 of Hibernate in a Java Web project with JSP.
I mapped the entity classes and all my relationships are set to Lazy.
I have a generic DAO where my objects EntityManagerFactory and EntityManager are declared as static.

There is a @OneToMany relationship between Person and Document, so I have a List in the Person class.
When listing the people in the application, I invoke the getDocuments() method and then Hibernate fetches and fills the objects in this list (because it is Lazy Loading).

The problem is that when I do an INSERT in the database and press F5 in the application, the list does not update. Only the new data appears if I stop TomCat and start it again.
It seems to be something about cache, but I have already tried to include the hibernate.cache.use_second_level_cache and hibernate.cache.use_query_cache properties tags as FALSE in persistence.xml, and the problem continues. It still caches.

I tried to remove the static word from the EntityManager declaration and not call close() method and, by generating a different connection to each query, the list updates, however the list of connection processes only increases. And I can not close calling close(), because it gives error when trying to load what is Lazy at runtime if the connection is terminated.

In summary, I need to effectively disable the query cache and I’m not getting it. Can someone help me?!

Thanks!!!

Without posting the code, it’s impossible to tell what’s causing your issue.