I’m currently configuring hibernate to use ehcache and provide a CacheManager programmatically. We do not use hibernate.xml nor ehcache.xml as we have our own configuration service to provide such informataion.
Now I’m facing an issue: where must the configuration cache usage be defined programmatically?
I’d like to activate it when I create the CacheConfiguration if it is possible but I do not find a method that allows setting the property.
Thanks in advance
this forum post can help here.
all you need to do afer writing the code by “F.Degenaar” is, while creating the session factory, create a
java.util.Propertiesobject add the property (key)hibernate.cache.provider_classand value the fully qualified class name with theEhCacheProvider.–edit
you can add the objects to cache manually, as far as programatically settting something to be cached or not is concerned, its gonna be quite difficult as the annotations are at compile time, Id recommend you to use the annotation and programatically cache/avoid caching queries and results.