Does HQL update clear 2nd level cache?

前端 未结 3 1505
时光说笑
时光说笑 2020-12-15 06:40

Native queries are clearing the 2nd level cache entries. An answer from the hibernate forum that is 7 years old says that HQL update queries also clear the 2nd level cache.

3条回答
  •  -上瘾入骨i
    2020-12-15 07:11

    We did see HQL update clearing the 2nd level cache when running with Hibernate 3.2.x

    As a simple way to validate for your individual setup, implement something like:

    http://narcanti.keyboardsamurais.de/hibernate-statistics-jsp-reloaded.html

    Note details on that page before and after running the HQL update transaction ...

    Or gather stats directly in your code and/or using JMX

    http://docs.jboss.org/hibernate/core/3.5/reference/en/html/performance.html#performance-monitoring

    As for improved behaviour, the Hibernate project might be open to implement a patch :)

提交回复
热议问题