I store some entities that are not changed via Hibernate in Hibernate 2nd level cache. Also, I perform a lot of native SQL queries (updates) via Hibernate SessionFactory. Every time I execute native SQL query, second level cache is invalidated.
Here is good explanation of the behaviour. I can not go over the system and add sqlQuery.addSynchronizedQuerySpace("");
Is there any way to disable that behaviour? If I update cached entities using native SQL, it's my responsibility to invalidate 2nd level cache.