当前位置: 首页>>代码示例>>Java>>正文


Java NaturalIdRegionAccessStrategy.evict方法代码示例

本文整理汇总了Java中org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy.evict方法的典型用法代码示例。如果您正苦于以下问题:Java NaturalIdRegionAccessStrategy.evict方法的具体用法?Java NaturalIdRegionAccessStrategy.evict怎么用?Java NaturalIdRegionAccessStrategy.evict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy的用法示例。


在下文中一共展示了NaturalIdRegionAccessStrategy.evict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeNaturalIdCrossReference

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入方法依赖的package包/类
/**
 * Handle removing cross reference entries for the given natural-id/pk combo
 *
 * @param persister The persister representing the entity type.
 * @param pk The primary key value
 * @param naturalIdValues The natural id value(s)
 * 
 * @return The cached values, if any.  May be different from incoming values.
 */
public Object[] removeNaturalIdCrossReference(EntityPersister persister, Serializable pk, Object[] naturalIdValues) {
	persister = locatePersisterForKey( persister );
	validateNaturalId( persister, naturalIdValues );

	final NaturalIdResolutionCache entityNaturalIdResolutionCache = naturalIdResolutionCacheMap.get( persister );
	Object[] sessionCachedNaturalIdValues = null;
	if ( entityNaturalIdResolutionCache != null ) {
		final CachedNaturalId cachedNaturalId = entityNaturalIdResolutionCache.pkToNaturalIdMap
				.remove( pk );
		if ( cachedNaturalId != null ) {
			entityNaturalIdResolutionCache.naturalIdToPkMap.remove( cachedNaturalId );
			sessionCachedNaturalIdValues = cachedNaturalId.getValues();
		}
	}

	if ( persister.hasNaturalIdCache() ) {
		final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = persister
				.getNaturalIdCacheAccessStrategy();
		final NaturalIdCacheKey naturalIdCacheKey = new NaturalIdCacheKey( naturalIdValues, persister, session() );
		naturalIdCacheAccessStrategy.evict( naturalIdCacheKey );

		if ( sessionCachedNaturalIdValues != null
				&& !Arrays.equals( sessionCachedNaturalIdValues, naturalIdValues ) ) {
			final NaturalIdCacheKey sessionNaturalIdCacheKey = new NaturalIdCacheKey( sessionCachedNaturalIdValues, persister, session() );
			naturalIdCacheAccessStrategy.evict( sessionNaturalIdCacheKey );
		}
	}

	return sessionCachedNaturalIdValues;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:NaturalIdXrefDelegate.java

示例2: removeSharedNaturalIdCrossReference

import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; //导入方法依赖的package包/类
@Override
		public void removeSharedNaturalIdCrossReference(EntityPersister persister, Serializable id, Object[] naturalIdValues) {
			if ( !persister.hasNaturalIdentifier() ) {
				// nothing to do
				return;
			}

			if ( ! persister.hasNaturalIdCache() ) {
				// nothing to do
				return;
			}

			// todo : couple of things wrong here:
			//		1) should be using access strategy, not plain evict..
			//		2) should prefer session-cached values if any (requires interaction from removeLocalNaturalIdCrossReference

			persister = locateProperPersister( persister );
			final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = persister.getNaturalIdCacheAccessStrategy();
			final NaturalIdCacheKey naturalIdCacheKey = new NaturalIdCacheKey( naturalIdValues, persister, session );
			naturalIdCacheAccessStrategy.evict( naturalIdCacheKey );

//			if ( sessionCachedNaturalIdValues != null
//					&& !Arrays.equals( sessionCachedNaturalIdValues, deletedNaturalIdValues ) ) {
//				final NaturalIdCacheKey sessionNaturalIdCacheKey = new NaturalIdCacheKey( sessionCachedNaturalIdValues, persister, session );
//				naturalIdCacheAccessStrategy.evict( sessionNaturalIdCacheKey );
//			}
		}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:StatefulPersistenceContext.java


注:本文中的org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy.evict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。