org.hibernate.engine.spi.SessionFactoryImplementor.getUpdateTimestampsCache()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.hibernate.engine.spi.SessionFactoryImplementor.getUpdateTimestampsCache()方法的一些代码示例,展示了SessionFactoryImplementor.getUpdateTimestampsCache()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SessionFactoryImplementor.getUpdateTimestampsCache()方法的具体详情如下:
包路径:org.hibernate.engine.spi.SessionFactoryImplementor
类名称:SessionFactoryImplementor
方法名:getUpdateTimestampsCache

SessionFactoryImplementor.getUpdateTimestampsCache介绍

[英]Get the cache of table update timestamps
[中]获取表更新时间戳的缓存

代码示例

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

/**
 *
 * @param em
 * @param entityType
 * @param ids
 */
public static void executeTargetedCacheInvalidation(EntityManager em, Class<?> entityType, List<Long> ids) {
  Session session = em.unwrap(Session.class);
  for (Long id : ids) {
    session.getSessionFactory().getCache().evictEntity(entityType, id);
  }
  //update the timestamp cache for the table so that queries will be refreshed
  ClassMetadata metadata = session.getSessionFactory().getClassMetadata(entityType);
  String tableName = ((AbstractEntityPersister) metadata).getTableName();
  UpdateTimestampsCache timestampsCache = em.unwrap(SessionImplementor.class).getFactory().getUpdateTimestampsCache();
  if (timestampsCache != null) {
    timestampsCache.invalidate(new Serializable[]{tableName});
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public void afterTransactionCompletion(boolean success) {
    for ( AfterTransactionCompletionProcess process : processes ) {
      try {
        process.doAfterTransactionCompletion( success, session );
      }
      catch ( CacheException ce ) {
        LOG.unableToReleaseCacheLock( ce );
        // continue loop
      }
      catch ( Exception e ) {
        throw new AssertionFailure( "Exception releasing cache locks", e );
      }
    }
    processes.clear();
    if ( session.getFactory().getSettings().isQueryCacheEnabled() ) {
      session.getFactory().getUpdateTimestampsCache().invalidate(
          querySpacesToInvalidate.toArray( new String[ querySpacesToInvalidate.size()] )
      );
    }
    querySpacesToInvalidate.clear();
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public void afterTransactionCompletion(boolean success) {
    for ( AfterTransactionCompletionProcess process : processes ) {
      try {
        process.doAfterTransactionCompletion( success, session );
      }
      catch ( CacheException ce ) {
        LOG.unableToReleaseCacheLock( ce );
        // continue loop
      }
      catch ( Exception e ) {
        throw new AssertionFailure( "Exception releasing cache locks", e );
      }
    }
    processes.clear();
    if ( session.getFactory().getSettings().isQueryCacheEnabled() ) {
      session.getFactory().getUpdateTimestampsCache().invalidate(
          querySpacesToInvalidate.toArray( new String[ querySpacesToInvalidate.size()] )
      );
    }
    querySpacesToInvalidate.clear();
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

private void registerCleanupActions(Executable executable) {
  beforeTransactionProcesses.register( executable.getBeforeTransactionCompletionProcess() );
  if ( session.getFactory().getSettings().isQueryCacheEnabled() ) {
    final String[] spaces = (String[]) executable.getPropertySpaces();
    if ( spaces != null && spaces.length > 0 ) { //HHH-6286
      afterTransactionProcesses.addSpacesToInvalidate( spaces );
      session.getFactory().getUpdateTimestampsCache().preinvalidate( spaces );
    }
  }
  afterTransactionProcesses.register( executable.getAfterTransactionCompletionProcess() );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

private void registerCleanupActions(Executable executable) {
  beforeTransactionProcesses.register( executable.getBeforeTransactionCompletionProcess() );
  if ( session.getFactory().getSettings().isQueryCacheEnabled() ) {
    final String[] spaces = (String[]) executable.getPropertySpaces();
    if ( spaces != null && spaces.length > 0 ) { //HHH-6286
      afterTransactionProcesses.addSpacesToInvalidate( spaces );
      session.getFactory().getUpdateTimestampsCache().preinvalidate( spaces );
    }
  }
  afterTransactionProcesses.register( executable.getAfterTransactionCompletionProcess() );
}

相关文章

微信公众号

最新文章

更多

SessionFactoryImplementor类方法