org.hibernate.ogm.model.spi.Association.reset()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(108)

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

Association.reset介绍

[英]Reset the association to the datastore state.
[中]将关联重置为数据存储状态。

代码示例

代码示例来源:origin: hibernate/hibernate-ogm

public static void updateAssociation(Association association) {
  Map<RowKey, Map<String, Object>> underlyingMap = ( (MapAssociationSnapshot) association.getSnapshot() ).getUnderlyingMap();
  for ( AssociationOperation action : association.getOperations() ) {
    switch ( action.getType() ) {
      case CLEAR:
        underlyingMap.clear();
        break;
      case PUT:
        underlyingMap.put( action.getKey(), MapHelpers.associationRowToMap( action.getValue() ) );
        break;
      case REMOVE:
        underlyingMap.remove( action.getKey() );
        break;
    }
  }
  // the snapshot has been updated so we have to clear the various operations added to the Association
  association.reset();
}

代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-infinispan-remote

private void insertOrUpdateAssociation(InsertOrUpdateAssociationOperation insertOrUpdateAssociationOperation) {
  AssociationKey associationKey = insertOrUpdateAssociationOperation.getAssociationKey();
  org.hibernate.ogm.model.spi.Association association = insertOrUpdateAssociationOperation.getAssociation();
  AssociationContext associationContext = insertOrUpdateAssociationOperation.getContext();
  if ( !associationStoredWithinEntityEntry( associationKey, associationContext ) ) {
    insertOrUpdateAssociationMappedAsDedicatedEntries( associationKey, association, associationContext );
  }
  association.reset();
}

代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-ehcache

@Override
public void insertOrUpdateAssociation(AssociationKey key, Association association, AssociationContext associationContext) {
  Map<SerializableRowKey, Map<String, Object>> associationRows = ( (SerializableMapAssociationSnapshot) association.getSnapshot() ).getUnderlyingMap();
  for ( AssociationOperation action : association.getOperations() ) {
    switch ( action.getType() ) {
      case CLEAR:
        associationRows.clear();
        break;
      case PUT:
        associationRows.put( new SerializableRowKey( action.getKey() ), MapHelpers.associationRowToMap( action.getValue() ) );
        break;
      case REMOVE:
        associationRows.remove( new SerializableRowKey( action.getKey() ) );
        break;
    }
  }
  association.reset();
  final Cache<AK> associationCache = getCacheManager().getAssociationCache( key.getMetadata() );
  associationCache.put( new Element( getKeyProvider().getAssociationCacheKey( key ), associationRows ) );
}

相关文章