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

Anders Wallgren (JIRA) noreply at atlassian.com
Fri Jun 8 18:41:04 EDT 2007


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

Anders Wallgren commented on HHH-2661:
--------------------------------------

Hmmm.  On second thought, I might be off in the weeds on this -- we still want cache coherency (for other sessions) even if this session ignores the cache.

> Second-level cache is used after Session.setCacheMode(CacheMode.IGNORE)
> -----------------------------------------------------------------------
>
>                 Key: HHH-2661
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2661
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: caching (L2)
>    Affects Versions: 3.2.4.sp1
>         Environment: Windows Vista
> MySQL 5.0
>            Reporter: Anders Wallgren
>
> 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