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

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

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

Association.getSnapshot介绍

[英]Returns the snapshot upon which this association is based, i.e. its original state when loaded from the datastore or newly created.
[中]返回此关联所基于的快照,即从数据存储加载或新创建时的原始状态。

代码示例

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

@Override
public void insertOrUpdateAssociation(AssociationKey key, Association association, AssociationContext associationContext) {
  MapHelpers.updateAssociation( association );
  // the association might have been removed prior to the update so we need to be sure it is present in the Map
  provider.putAssociation( key, ( (MapAssociationSnapshot) association.getSnapshot() ).getUnderlyingMap() );
}

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

@Override
public void insertOrUpdateAssociation(AssociationKey key, Association association, AssociationContext associationContext) {
  if ( association.getSnapshot().size() == 0 ) {
    log.tracef( "Creating association with key %1$s in datastore", key );
  }
  else {
    log.tracef( "Updating association with key %1$s in datastore", key );
  }
  super.insertOrUpdateAssociation( key, association, associationContext );
}

代码示例来源: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-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 ) );
}

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

AssociationSnapshot snapshot = association.getSnapshot();
Tuple previousStateTuple = snapshot.get( op.getKey() );
Tuple currentStateTuple = op.getValue();

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

MongoDBAssociationSnapshot associationSnapshot = (MongoDBAssociationSnapshot) association.getSnapshot();
MongoCollection<Document> associationCollection = getAssociationCollection( associationKey, storageStrategy, associationContext );
Document query = associationSnapshot.getQueryObject();

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

MongoDBAssociationSnapshot associationSnapshot = (MongoDBAssociationSnapshot) association.getSnapshot();
MongoCollection<Document> associationCollection = getAssociationCollection( associationKey, storageStrategy, associationContext );
Document query = associationSnapshot.getQueryObject();

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

AssociationContext associationContext = insertOrUpdateAssociationOperation.getContext();
CouchDBAssociation couchDBAssociation = ( (CouchDBAssociationSnapshot) association.getSnapshot() ).getCouchDbAssociation();
Object rows = getAssociationRows( association, associationKey, associationContext );

相关文章