[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5303) @Cachable has no effect

Steve Ebersole (JIRA) noreply at atlassian.com
Tue Jun 15 01:07:58 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37453#action_37453 ] 

Steve Ebersole commented on HHH-5303:
-------------------------------------

Its not just difficult, its impossible.  Why?  Well say you chose READ_WRITE as the default as you suggest.  The problem is that if you run with JBossCache or (I believe) Infinispan, READ_WRITE is not a valid option.  The underlying problem is that (1) not all providers support all access types and (2) we do not really define a "hierarchy" amongst the access types to be able to switch over from one to the other automatically if a provider did not support the specified one.

And its not just an issue with READ_WRITE itself as the specific access type.

> @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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list