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

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

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

Association.getOperations介绍

[英]Return the list of actions on the tuple. Operations are inherently deduplicated, i.e. there will be at most one operation for a specific row key.

Note that the global CLEAR operation is put at the top of the list.
[中]返回元组上的操作列表。操作本身就是重复数据消除的,即对于特定的行键,最多只能执行一次操作。
请注意,全局清除操作位于列表的顶部。

代码示例

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

@Override
public void insertOrUpdateAssociation(AssociationKey key, Association association, AssociationContext associationContext) {
  // If this is the inverse side of a bi-directional association, we don't create a relationship for this; this
  // will happen when updating the main side
  if ( key.getMetadata().isInverse() ) {
    return;
  }
  for ( AssociationOperation action : association.getOperations() ) {
    applyAssociationOperation( association, key, action, associationContext );
  }
}

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

@Override
public void insertOrUpdateAssociation(AssociationKey key, Association association, AssociationContext associationContext) {
  // If this is the inverse side of a bi-directional association, we don't create a relationship for this; this
  // will happen when updating the main side
  if ( key.getMetadata().isInverse() ) {
    return;
  }
  for ( AssociationOperation action : association.getOperations() ) {
    applyAssociationOperation( association, key, action, associationContext );
  }
}

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

@Override
public void insertOrUpdateAssociation(AssociationKey key, Association association, AssociationContext associationContext) {
  // If this is the inverse side of a bi-directional association, we don't create a relationship for this; this
  // will happen when updating the main side
  if ( key.getMetadata().isInverse() ) {
    return;
  }
  for ( AssociationOperation action : association.getOperations() ) {
    applyAssociationOperation( association, key, action, 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-cassandra

association.getOperations()
        .size()
);
List<AssociationOperation> deleteOps = new ArrayList<AssociationOperation>(
    association.getOperations()
        .size()
);
for ( AssociationOperation op : association.getOperations() ) {
  switch ( op.getType() ) {
    case CLEAR:

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

/**
 * Writes out the changes gathered in the {@link Association} managed by this persister to the datastore.
 */
public void flushToDatastore() {
  if ( getAssociation().isEmpty() ) {
    gridDialect.removeAssociation( getAssociationKey(), getAssociationContext() );
    association = null;
    OgmEntityEntryState.getStateFor( session, hostingEntity ).setAssociation( associationKeyMetadata.getCollectionRole(), null );
  }
  else if ( !getAssociation().getOperations().isEmpty() ) {
    gridDialect.insertOrUpdateAssociation( getAssociationKey(), getAssociation(), getAssociationContext() );
  }
  updateHostingEntityIfRequired();
}

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

private void insertOrUpdateAssociationMappedAsDedicatedEntries(AssociationKey key, Association association, AssociationContext associationContext) {
  final String cacheName = cacheName( key );
  final ProtoStreamMappingAdapter mapper = provider.getDataMapperForCache( cacheName );
  log.debugf( "insertOrUpdateAssociation for key '%s' on cache '%s', mapped as dedicated entries in ad-hoc table", key, cacheName );
  final List<AssociationOperation> operations = association.getOperations();
  for ( AssociationOperation ao : operations ) {
    AssociationOperationType type = ao.getType();
    RowKey rowKey = ao.getKey();
    ProtostreamId idBuffer = mapper.createIdPayload( rowKey.getColumnNames(), rowKey.getColumnValues() );
    switch ( type ) {
      case PUT:
        ProtostreamPayload valuePayloadForPut = mapper.createValuePayload( ao.getValue() );
        mapper.withinCacheEncodingContext( c -> c.put( idBuffer, valuePayloadForPut ) );
        break;
      case REMOVE:
        mapper.withinCacheEncodingContext( c -> c.remove( idBuffer ) );
        break;
      case CLEAR:
        throw new AssertionFailure( "Request for CLEAR operation on an association mapped to dedicated entries. Makes no sense?" );
    }
  }
}

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

boolean thirdTableAssociation = IgniteAssociationSnapshot.isThirdTableAssociation( key.getMetadata() );
for ( AssociationOperation op : association.getOperations() ) {
  AssociationSnapshot snapshot = association.getSnapshot();
  Tuple previousStateTuple = snapshot.get( op.getKey() );
for ( AssociationOperation op : association.getOperations() ) {
  int index = findIndexByRowKey( associationObjects, op.getKey(), indexColumnName );
  switch ( op.getType() ) {

相关文章