I have used ehcache in my application. I deploy my application in jbossAS7 server. I want to disable second level cache now. I have removed the cache properties from my hibernate configuration file, deleted my ehcache.xml file, removed the cache usage from all the hbm files. When I deploy my project in jboss, I can see that the second level cache is enabled.
[org.hibernate.cfg.SettingsFactory] (MSC service thread 1-6) Second-level cache: enabled
How do I disable it?
you can do this sessionFactory.getCache().evict(..); and else you can follow this link, which will explain you everything and tell you how to do it
http://jaitechwriteups.blogspot.com/2006/08/evict-collection-from-hibernate-second.html