I am trying to use OPTIMISTIC NODE LOCKING for my second level cache. Based on what I have read, using
property name="hibernate.cache.provider_class" value="org.hibernate.cache.OptimisticTreeCacheProvider"
in persistence.xml and providing an XML config file using
property name="hibernate.cache.opt_tree_cache.config" value="..."
works, but it results in having a cache that is not managed by the app server. To avoid that problem, is it correct/enough to use
org.jboss.ejb3.entity.OptimisticTreeCacheProviderHook as my cache.provider_class and change the ejb3-entity-cache-service.xml in my deploy directory to use OPTIMISTIC NODE LOCKING? I did that and didn't get any errors, but I'm not sure if it gives me real OPTMISTIC NODE LOCKING behavior.
I'm using JBoss AS 4.2.3 and Hibernate 3.3.1.
Thanks a lot
Just look at your cache config XML. If it specifies NodeLockingScheme as OPTIMISTIC, then that is what you are using. Otherwise, switch your log level to DEBUG and look at the interceptor stack the cache reports when it starts up. If you see any OptimisticXYZInterceptors there, then you have OPTIMISTIC locking.