How to disable completely Hibernate caching? (with Spring 3, Hibernate with annotations) -
java app asks mysql server query every 10 seconds.
manually insert table new row.
, hibernate can't find it.
when manually remove row, hibernate shows row exists.
suggest because hibernate caching.
there way disable @ all?
thank you!
do mean first-level cache or second-level cache? having hibernate second-level cache such ehcache caches entities correspond rows in same table modify manually cause behaviour describe. first-level cache not cause behaviour, , don't think can disable it, anyway.
to disable hibernate second-level cache, remove hibernate configuration file, hibernate-cfg.xml
, lines refer second-level cache. example:
<!-- enable second-level cache --> <property name="hibernate.cache.provider_class"> net.sf.ehcache.hibernate.ehcacheprovider </property> <property name="hibernate.cache.region.factory_class"> net.sf.ehcache.hibernate.ehcacheregionfactory </property> <property name="hibernate.cache.use_query_cache">true</property> <property name="hibernate.cache.use_second_level_cache">true</property> <property name="hibernate.cache.use_structured_entries">true</property> <property name="hibernate.cache.generate_statistics">true</property>
Comments
Post a Comment