[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2661) Second-level cache is used after Session.setCacheMode(CacheMode.IGNORE)

Daniel Jimenez (JIRA) noreply at atlassian.com
Wed Mar 10 19:20:47 EST 2010


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

Daniel Jimenez commented on HHH-2661:
-------------------------------------

Seeing the same thing over here...

> Second-level cache is used after Session.setCacheMode(CacheMode.IGNORE)
> -----------------------------------------------------------------------
>
>                 Key: HHH-2661
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2661
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: caching (L2)
>    Affects Versions: 3.2.4.sp1
>         Environment: Windows Vista
> MySQL 5.0
>            Reporter: Anders Wallgren
>         Attachments: TestCacheProvider.java
>
>
> I'm doing some bulk importing and want to disable the L2 cache, so I call Session.setCacheMode(CacheMode.IGNORE) before doing any work.
> However, the entities I'm creating still end up in the cache.  It seems that org.hibernate.action.CollectionAction isn't doing the correct check to determine when to cache -- it only check for the existence of a configured cache, but doesn't check whether caching is enabled in the session.
> For example, from CollectionAction.beforeExecutions:
> 	public final void beforeExecutions() throws CacheException {
> 		// we need to obtain the lock before any actions are
> 		// executed, since this may be an inverse="true"
> 		// bidirectional association and it is one of the
> 		// earlier entity actions which actually updates
> 		// the database (this action is resposible for
> 		// second-level cache invalidation only)
> 		if ( persister.hasCache() ) {
> 			final CacheKey ck = new CacheKey( 
> 					key, 
> 					persister.getKeyType(), 
> 					persister.getRole(), 
> 					session.getEntityMode(), 
> 					session.getFactory() 
> 				);
> 			lock = persister.getCache().lock(ck, null);
> 		}
> 	}
> Shouldn't "if ( persister.hasCache() )" be persistence.hasCache && getSession.getCacheMode.isPutEnabled(), or something along those lines?

-- 
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