org.hibernate.cache.spi.support.AbstractCollectionDataAccess Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.cache.spi.support;
import org.hibernate.cache.cfg.spi.CollectionDataCachingConfig;
import org.hibernate.cache.spi.CacheKeysFactory;
import org.hibernate.cache.spi.DomainDataRegion;
import org.hibernate.cache.spi.access.CollectionDataAccess;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.persister.collection.CollectionPersister;
/**
* @author Steve Ebersole
*/
public abstract class AbstractCollectionDataAccess
extends AbstractCachedDomainDataAccess
implements CollectionDataAccess {
private final CacheKeysFactory keysFactory;
public AbstractCollectionDataAccess(
DomainDataRegion region,
CacheKeysFactory keysFactory,
DomainDataStorageAccess storageAccess,
CollectionDataCachingConfig config) {
super( region, storageAccess );
this.keysFactory = keysFactory;
}
@Override
public Object generateCacheKey(Object id, CollectionPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) {
return keysFactory.createCollectionKey( id, persister, factory, tenantIdentifier );
}
@Override
public Object getCacheKeyId(Object cacheKey) {
return keysFactory.getCollectionId( cacheKey );
}
@Override
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) {
return null;
}
@Override
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) {
}
@Override
public SoftLock lockRegion() {
return null;
}
@Override
public void unlockRegion(SoftLock lock) {
clearCache();
}
}