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


Java TupleContext类代码示例

本文整理汇总了Java中org.hibernate.ogm.dialect.spi.TupleContext的典型用法代码示例。如果您正苦于以下问题:Java TupleContext类的具体用法?Java TupleContext怎么用?Java TupleContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TupleContext类属于org.hibernate.ogm.dialect.spi包,在下文中一共展示了TupleContext类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchObject

import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
private ObjectNode fetchObject(EntityKey key, TupleContext tupleContext) {
    LightblueEntityMetadataId entityId = LightblueEntityMetadataId.extractEntityInfo(key.getMetadata());
    DataFindRequest request = new DataFindRequest(entityId.entityName, entityId.entityVersion);
    request.where(new ValueQuery("_id", ExpressionOperation.EQUALS, key.getColumnValues()[0].toString()));
    List<Projection> projections = new ArrayList<Projection>(Arrays.asList(projectionsFromColumns(tupleContext.getSelectableColumns())));
    projections.add(new FieldProjection("_id", true, true));
    request.select(projections);
    try {
        LightblueResponse response = provider.getLightblueClient().data(request);
        if (response.hasError()) {
            throw new RuntimeException("Error returned in response: " + response.getText());
        }
        return (ObjectNode) response.getJson().get("processed").get(0);
    } catch (LightblueException e) {
        throw new RuntimeException("Unable to communicate with lightblue.", e);
    }
}
 
开发者ID:kahowell,项目名称:lightblue-hibernate-ogm,代码行数:18,代码来源:LightblueDialect.java

示例2: insertOrUpdateTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
@Override
public void insertOrUpdateTuple(EntityKey key, TuplePointer tuplePointer, TupleContext tupleContext) throws TupleAlreadyExistsException {
	IgniteCache<Object, BinaryObject> entityCache = provider.getEntityCache( key.getMetadata() );
	Tuple tuple = tuplePointer.getTuple();

	Object keyObject = null;
	BinaryObjectBuilder builder = null;
	IgniteTupleSnapshot tupleSnapshot = (IgniteTupleSnapshot) tuple.getSnapshot();
	keyObject = tupleSnapshot.getCacheKey();
	if ( tuple.getSnapshotType() == SnapshotType.UPDATE ) {
		builder = provider.createBinaryObjectBuilder( tupleSnapshot.getCacheValue() );
	}
	else {
		builder = provider.createBinaryObjectBuilder( provider.getEntityTypeName( key.getMetadata().getTable() ) );
	}
	for ( String columnName : tuple.getColumnNames() ) {
		Object value = tuple.get( columnName );
		if ( value != null ) {
			builder.setField( StringHelper.realColumnName( columnName ), value );
		}
		else {
			builder.removeField( StringHelper.realColumnName( columnName ) );
		}
	}
	BinaryObject valueObject = builder.build();
	entityCache.put( keyObject, valueObject );
	tuplePointer.setTuple( new Tuple( new IgniteTupleSnapshot( keyObject, valueObject, key.getMetadata() ), SnapshotType.UPDATE ) );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:29,代码来源:IgniteDialect.java

示例3: getTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
@Override
public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    ObjectNode object = fetchObject(key, tupleContext);
    if (object != null) {
        return new Tuple(new LightblueTupleSnapshot(object, key.getMetadata(), OperationType.UPDATE));
    }
    if (isInQueue(key, tupleContext)) {
        return createTuple(key, tupleContext);
    }
    return null;
}
 
开发者ID:kahowell,项目名称:lightblue-hibernate-ogm,代码行数:12,代码来源:LightblueDialect.java

示例4: removeTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
@Override
public void removeTuple(EntityKey key, TupleContext tupleContext) {
    LightblueEntityMetadataId entityId = LightblueEntityMetadataId.extractEntityInfo(key.getMetadata());
    DataDeleteRequest request = new DataDeleteRequest(entityId.entityName, entityId.entityVersion);
    request.where(new ValueQuery("_id", ExpressionOperation.EQUALS, key.getColumnValues()[0].toString()));
    try {
        LightblueResponse data = provider.getLightblueClient().data(request);
        System.out.println(data.getJson());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:kahowell,项目名称:lightblue-hibernate-ogm,代码行数:13,代码来源:LightblueDialect.java

示例5: removeTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
@Override
public void removeTuple(EntityKey key, TupleContext tupleContext) {
	remove( key );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-redis,代码行数:5,代码来源:AbstractRedisDialect.java

示例6: removeTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
@Override
public void removeTuple(EntityKey key, TupleContext tupleContext) {
	IgniteCache<Object, BinaryObject> entityCache = provider.getEntityCache( key.getMetadata() );
	entityCache.remove( provider.createKeyObject( key ) );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:6,代码来源:IgniteDialect.java

示例7: executeBackendUpdateQuery

import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
@Override
public int executeBackendUpdateQuery(BackendQuery<IgniteQueryDescriptor> query, QueryParameters queryParameters, TupleContext tupleContext) {
	throw new UnsupportedOperationException( "executeBackendUpdateQuery() is not implemented" );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:5,代码来源:IgniteDialect.java

示例8: isInQueue

import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
private boolean isInQueue(EntityKey key, TupleContext tupleContext) {
    return tupleContext.getOperationsQueue() != null && tupleContext.getOperationsQueue().contains(key);
}
 
开发者ID:kahowell,项目名称:lightblue-hibernate-ogm,代码行数:4,代码来源:LightblueDialect.java

示例9: createTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
@Override
public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    return new Tuple(new LightblueTupleSnapshot(mapper.createObjectNode(), key.getMetadata(), OperationType.INSERT));
}
 
开发者ID:kahowell,项目名称:lightblue-hibernate-ogm,代码行数:5,代码来源:LightblueDialect.java


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