Question

When you run a JPQL update or delete query, is Hibernate smart enough to invalidate the 2nd-level cache for the entity that is changed?

Contrived example:

You have the JPQL:

update Product p set p.status = 'S' where p.name like 'Monitor%'

If you currently have products in the 2nd-level cache when that statement is run, will Hibernate invalidate all products from the cache or does it do nothing to the cache and the products in the 2nd level cache are now invalid?

Just FYI... I'm using JBoss 5.1 with Hibernate and JBossCache

Was it helpful?

Solution

After running my own test and running across this bug it appears that it will invalidate the ENTIRE second-level cache, not just the second-level cache for any entities involved in the update.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top