[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5303?page=c...
]
Steve Ebersole commented on HHH-5303:
-------------------------------------
Just a raw @Cacheable annotation is quite difficult for Hibernate to decipher because of
its pluggable cache region factories and granular access types, especially because not all
caching providers support all of the access types.
As of this moment, what it does is to ask the RegionFactory (the "cache
provider") which is the default. So as I asked a few posts ago, it depends on which
factory/provider you have specified.
Looking at org.hibernate.cfg.AnnotationBinder#prepareDefaultCacheConcurrencyStrategy (not
currently used) it seems that either I planned on allowing setting this via config but
forgot to "hook it up" or allowed it before adding the
org.hibernate.cache.RegionFactory#getDefaultAccessType method and forgot to remove it.
This was done at a time of a lot of rapid development for JPA2 and I did not do a great
job of documenting the intentions here in the code. But i remember having a lot of
discussion of this at the time.
It seems reasonable right now to blend these 2 things together such that we first look for
an explicit config value (ala #prepareDefaultCacheConcurrencyStrategy) and use that if
defined; otherwise we look to the RegionFactory for it's default. I need to think
that through a bit though.
@Cachable has no effect
-----------------------
Key: HHH-5303
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5303
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2), entity-manager
Affects Versions: 3.5.2
Environment: Tested on HSQL (included in testcase) and MySQL database
Reporter: Paul Bakker
Attachments: testcase.zip
The JPA 2.0 @Cachable annotation has no effect at all. Just putting @Cachable on a class
is not enough to enable caching. You must also configure a concurrency strategy with
either @Cache or a hibernate.ejb.classcache setting in persistence.xml.
If those settings are in place, @Cacheble still has no effect. Entities are cached, but
@Cachable(false) doesn't change this behavior.
I included a Maven example project that tests this behavior. The project has two profiles
to switch between Hibernate and EclipseLink:
mvn -P hibernate clean test
mvn -P eclipselink clean test
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira