本文整理了Java中org.hibernate.ogm.model.spi.Association.<init>()
方法的一些代码示例,展示了Association.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Association.<init>()
方法的具体详情如下:
包路径:org.hibernate.ogm.model.spi.Association
类名称:Association
方法名:<init>
[英]Creates a new association, based on an empty association snapshot.
[中]基于空关联快照创建新关联。
代码示例来源:origin: hibernate/hibernate-ogm
@Override
public Association createAssociation(AssociationKey associationKey, AssociationContext associationContext) {
return new Association();
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-cassandra
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
return new Association( new MapAssociationSnapshot( new HashMap<RowKey, Map<String, Object>>() ) );
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-infinispan-remote
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
Map<RowKey, Map<String, Object>> associationMap = new HashMap<RowKey, Map<String,Object>>();
return new Association( new MapAssociationSnapshot( associationMap ) );
}
代码示例来源:origin: hibernate/hibernate-ogm
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
Map<RowKey, Map<String, Object>> associationMap = new HashMap<RowKey, Map<String,Object>>();
provider.putAssociation( key, associationMap );
return new Association( new MapAssociationSnapshot( associationMap ) );
}
代码示例来源:origin: hibernate/hibernate-ogm
@Override
public Association getAssociation(AssociationKey key, AssociationContext associationContext) {
Map<RowKey, Map<String, Object>> associationMap = provider.getAssociation( key );
return associationMap == null ? null : new Association( new MapAssociationSnapshot( associationMap ) );
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-infinispan-remote
@Override
public Association getAssociation(AssociationKey key, AssociationContext associationContext) {
if ( referencesDeleteEntity( key, associationContext ) ) {
return null;
}
Map<RowKey, Map<String, Object>> results = loadRowKeysByQuery( provider, key );
if ( results.isEmpty() ) {
// For consistency with other dialects,
// it make it easier to test which operations the dialects executes
return null;
}
return new Association( new MapAssociationSnapshot( results ) );
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-ehcache
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
final Cache<AK> associationCache = getCacheManager().getAssociationCache( key.getMetadata() );
Map<SerializableRowKey, Map<String, Object>> association = new HashMap<SerializableRowKey, Map<String, Object>>();
associationCache.put( new Element( getKeyProvider().getAssociationCacheKey( key ), association ) );
return new Association( new SerializableMapAssociationSnapshot( association ) );
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-ignite
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
if ( key.getMetadata().getAssociationKind() == AssociationKind.ASSOCIATION ) {
return new Association( new IgniteAssociationSnapshot( key ) );
}
else if ( key.getMetadata().getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION ) {
return new Association( new IgniteEmbeddedAssociationSnapshot( key, associationContext.getEntityTuplePointer().getTuple() ) );
}
else {
throw new UnsupportedOperationException( "Unknown association kind " + key.getMetadata().getAssociationKind() );
}
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-ehcache
@Override
public Association getAssociation(AssociationKey key, AssociationContext associationContext) {
final Cache<AK> associationCache = getCacheManager().getAssociationCache( key.getMetadata() );
final Element element = associationCache.get( getKeyProvider().getAssociationCacheKey( key ) );
if ( element == null ) {
return null;
}
else {
@SuppressWarnings("unchecked")
Map<SerializableRowKey, Map<String, Object>> associationRows = (Map<SerializableRowKey, Map<String, Object>>) element.getObjectValue();
return new Association( new SerializableMapAssociationSnapshot( associationRows ) );
}
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-mongodb
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );
Document document = storageStrategy == AssociationStorageStrategy.IN_ENTITY
? getEmbeddingEntity( key, associationContext )
: associationKeyToObject( key, storageStrategy );
Association association = new Association( new MongoDBAssociationSnapshot( document, key, storageStrategy ) );
// in the case of an association stored in the entity structure, we might end up with rows present in the
// current snapshot of the entity while we want an empty association here. So, in this case, we clear the
// snapshot to be sure the association created is empty.
if ( !association.isEmpty() ) {
association.clear();
}
return association;
}
代码示例来源:origin: hibernate/hibernate-ogm
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );
Document document = storageStrategy == AssociationStorageStrategy.IN_ENTITY
? getEmbeddingEntity( key, associationContext )
: associationKeyToObject( key, storageStrategy );
Association association = new Association( new MongoDBAssociationSnapshot( document, key, storageStrategy ) );
// in the case of an association stored in the entity structure, we might end up with rows present in the
// current snapshot of the entity while we want an empty association here. So, in this case, we clear the
// snapshot to be sure the association created is empty.
if ( !association.isEmpty() ) {
association.clear();
}
return association;
}
代码示例来源:origin: hibernate/hibernate-ogm
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
//TODO we don't verify that it does not yet exist assuming that this has been done before by the calling code
//should we improve?
Cache<AK, Map<RowKey, Map<String, Object>>> cache = getCacheManager().getAssociationCache(
key.getMetadata()
);
AK cacheKey = getKeyProvider().getAssociationCacheKey( key );
Map<RowKey, Map<String, Object>> atomicMap = AtomicMapLookup.getFineGrainedAtomicMap( cache, cacheKey, true );
return new Association( new MapAssociationSnapshot( atomicMap ) );
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-infinispan-embedded
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
//TODO we don't verify that it does not yet exist assuming that this has been done before by the calling code
//should we improve?
Cache<AK, Map<RowKey, Map<String, Object>>> cache = getCacheManager().getAssociationCache(
key.getMetadata()
);
AK cacheKey = getKeyProvider().getAssociationCacheKey( key );
Map<RowKey, Map<String, Object>> atomicMap = AtomicMapLookup.getFineGrainedAtomicMap( cache, cacheKey, true );
return new Association( new MapAssociationSnapshot( atomicMap ) );
}
代码示例来源:origin: hibernate/hibernate-ogm
@Override
public Association getAssociation(AssociationKey key, AssociationContext associationContext) {
Cache<AK, Map<RowKey, Map<String, Object>>> cache = getCacheManager().getAssociationCache(
key.getMetadata()
);
AK cacheKey = getKeyProvider().getAssociationCacheKey( key );
Map<RowKey, Map<String, Object>> atomicMap = AtomicMapLookup.getFineGrainedAtomicMap( cache, cacheKey, false );
return atomicMap == null ? null : new Association( new MapAssociationSnapshot( atomicMap ) );
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-infinispan-embedded
@Override
public Association getAssociation(AssociationKey key, AssociationContext associationContext) {
Cache<AK, Map<RowKey, Map<String, Object>>> cache = getCacheManager().getAssociationCache(
key.getMetadata()
);
AK cacheKey = getKeyProvider().getAssociationCacheKey( key );
Map<RowKey, Map<String, Object>> atomicMap = AtomicMapLookup.getFineGrainedAtomicMap( cache, cacheKey, false );
return atomicMap == null ? null : new Association( new MapAssociationSnapshot( atomicMap ) );
}
代码示例来源:origin: hibernate/hibernate-ogm
@Override
public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext) {
EntityKey entityKey = associationKey.getEntityKey();
Node entityNode = getEntityQueries( entityKey.getMetadata(), associationContext ).findEntity( dataBase, entityKey.getColumnValues() );
GraphLogger.log( "Found owner node: %1$s", entityNode );
if ( entityNode == null ) {
return null;
}
Map<RowKey, Tuple> tuples = createAssociationMap( associationKey, associationContext, entityKey );
return new Association( new EmbeddedNeo4jAssociationSnapshot( tuples ) );
}
代码示例来源:origin: hibernate/hibernate-ogm
@Override
public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext) {
EntityKey entityKey = associationKey.getEntityKey();
Transaction tx = transaction( associationContext );
NodeWithEmbeddedNodes node = getEntityQueries( entityKey.getMetadata(), associationContext ).findEntity( tx, entityKey.getColumnValues() );
if ( node == null ) {
return null;
}
Map<RowKey, Tuple> tuples = createAssociationMap( associationKey, associationContext, entityKey );
return new Association( new RemoteNeo4jAssociationSnapshot( tuples ) );
}
代码示例来源:origin: hibernate/hibernate-ogm
@Override
public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext) {
EntityKey entityKey = associationKey.getEntityKey();
Long transactionId = transactionId( associationContext.getTransactionContext() );
NodeWithEmbeddedNodes node = getEntityQueries( entityKey.getMetadata(), associationContext.getTupleTypeContext() ).findEntity( client, transactionId, entityKey.getColumnValues() );
if ( node == null ) {
return null;
}
Map<RowKey, Tuple> tuples = createAssociationMap( associationKey, associationContext, entityKey, associationContext.getTransactionContext() );
return new Association( new RemoteNeo4jAssociationSnapshot( tuples ) );
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-couchdb
@Override
public Association getAssociation(AssociationKey key, AssociationContext associationContext) {
CouchDBAssociation couchDBAssociation = null;
if ( isStoredInEntityStructure( key.getMetadata(), associationContext.getAssociationTypeContext() ) ) {
TuplePointer tuplePointer = getEmbeddingEntityTuplePointer( key, associationContext );
if ( tuplePointer == null ) {
// The entity associated with this association has already been removed
// see ManyToOneTest#testRemovalOfTransientEntityWithAssociation
return null;
}
EntityDocument owningEntity = getEntityFromTuple( tuplePointer.getTuple() );
if ( owningEntity != null && DotPatternMapHelpers.hasField(
owningEntity.getPropertiesAsHierarchy(),
key.getMetadata().getCollectionRole()
) ) {
couchDBAssociation = CouchDBAssociation.fromEmbeddedAssociation( tuplePointer, key.getMetadata() );
}
}
else {
AssociationDocument association = getDataStore().getAssociation( Identifier.createAssociationId( key ) );
if ( association != null ) {
couchDBAssociation = CouchDBAssociation.fromAssociationDocument( association );
}
}
return couchDBAssociation != null ? new Association( new CouchDBAssociationSnapshot( couchDBAssociation, key ) ) : null;
}
代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-couchdb
@Override
public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
CouchDBAssociation couchDBAssociation = null;
if ( isStoredInEntityStructure( key.getMetadata(), associationContext.getAssociationTypeContext() ) ) {
TuplePointer tuplePointer = getEmbeddingEntityTuplePointer( key, associationContext );
EntityDocument owningEntity = getEntityFromTuple( tuplePointer.getTuple() );
if ( owningEntity == null ) {
owningEntity = (EntityDocument) getDataStore().saveDocument( new EntityDocument( key.getEntityKey() ) );
tuplePointer.setTuple( new Tuple( new CouchDBTupleSnapshot( owningEntity ), SnapshotType.UPDATE ) );
}
couchDBAssociation = CouchDBAssociation.fromEmbeddedAssociation( tuplePointer, key.getMetadata() );
}
else {
AssociationDocument association = new AssociationDocument( Identifier.createAssociationId( key ) );
couchDBAssociation = CouchDBAssociation.fromAssociationDocument( association );
}
Association association = new Association( new CouchDBAssociationSnapshot( couchDBAssociation, key ) );
// in the case of an association stored in the entity structure, we might end up with rows present in the current snapshot of the entity
// while we want an empty association here. So, in this case, we clear the snapshot to be sure the association created is empty.
if ( !association.isEmpty() ) {
association.clear();
}
return association;
}
内容来源于网络,如有侵权,请联系作者删除!