本文整理汇总了Java中org.hibernate.ogm.model.key.spi.EntityKeyMetadata类的典型用法代码示例。如果您正苦于以下问题:Java EntityKeyMetadata类的具体用法?Java EntityKeyMetadata怎么用?Java EntityKeyMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityKeyMetadata类属于org.hibernate.ogm.model.key.spi包,在下文中一共展示了EntityKeyMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addKeyValuesFromKeyName
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
protected void addKeyValuesFromKeyName(
EntityKeyMetadata entityKeyMetadata,
String prefix,
String key,
Entity document) {
if ( key.startsWith( prefix ) ) {
String keyWithoutPrefix = getKeyWithoutTablePrefix( prefix, key );
Map<String, Object> keys = keyStringToMap( entityKeyMetadata, keyWithoutPrefix );
for ( Map.Entry<String, Object> entry : keys.entrySet() ) {
document.set( entry.getKey(), entry.getValue() );
}
}
}
示例2: addKeyValuesFromKeyName
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
protected void addKeyValuesFromKeyName(
EntityKeyMetadata entityKeyMetadata,
String prefix,
String key,
Map<String, String> document) {
if ( key.startsWith( prefix ) ) {
String keyWithoutPrefix = key.substring( prefix.length() );
Map<String, String> keys = keyToMap( entityKeyMetadata, keyWithoutPrefix );
for ( Map.Entry<String, String> entry : keys.entrySet() ) {
document.put( entry.getKey(), entry.getValue() );
}
}
}
示例3: IgniteTupleSnapshot
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
public IgniteTupleSnapshot(Object id, BinaryObject binaryObject, EntityKeyMetadata keyMetadata) {
this.id = id;
this.binaryObject = binaryObject;
this.keyMetadata = keyMetadata;
Set<String> idColumnNames = new HashSet<>();
for ( String columnName : keyMetadata.getColumnNames() ) {
if ( keyMetadata.isKeyColumn( columnName ) ) {
idColumnNames.add( columnName );
}
}
if ( idColumnNames.isEmpty() ) {
throw new UnsupportedOperationException( "There is no id column in entity " + keyMetadata.getTable() + ". Hmm..." );
}
this.isSimpleId = idColumnNames.size() == 1;
this.columnNames = CollectionHelper.asSet( keyMetadata.getColumnNames() );
}
示例4: createEntityCacheConfiguration
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
private CacheConfiguration<?,?> createEntityCacheConfiguration(EntityKeyMetadata entityKeyMetadata, SchemaDefinitionContext context) {
CacheConfiguration<?,?> cacheConfiguration = new CacheConfiguration<>();
cacheConfiguration.setStoreKeepBinary( true );
cacheConfiguration.setSqlSchema( QueryUtils.DFLT_SCHEMA );
cacheConfiguration.setBackups( 1 );
cacheConfiguration.setName( StringHelper.stringBeforePoint( entityKeyMetadata.getTable() ) );
cacheConfiguration.setAtomicityMode( CacheAtomicityMode.TRANSACTIONAL );
QueryEntity queryEntity = new QueryEntity();
queryEntity.setTableName( entityKeyMetadata.getTable() );
queryEntity.setKeyType( getEntityIdClassName( entityKeyMetadata.getTable(), context ).getSimpleName() );
queryEntity.setValueType( StringHelper.stringAfterPoint( entityKeyMetadata.getTable() ) );
addTableInfo( queryEntity, context, entityKeyMetadata.getTable() );
for ( AssociationKeyMetadata associationKeyMetadata : context.getAllAssociationKeyMetadata() ) {
if ( associationKeyMetadata.getAssociationKind() != AssociationKind.EMBEDDED_COLLECTION
&& associationKeyMetadata.getTable().equals( entityKeyMetadata.getTable() )
&& !IgniteAssociationSnapshot.isThirdTableAssociation( associationKeyMetadata ) ) {
appendIndex( queryEntity, associationKeyMetadata, context );
}
}
log.debugf( "queryEntity: %s", queryEntity );
cacheConfiguration.setQueryEntities( Arrays.asList( queryEntity ) );
return cacheConfiguration;
}
示例5: keyStringToMap
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
/**
* Deconstruct the key name into its components:
* Single key: Use the value from the key
* Multiple keys: De-serialize the JSON map.
*/
protected Map<String, Object> keyStringToMap(EntityKeyMetadata entityKeyMetadata, String key) {
if ( entityKeyMetadata.getColumnNames().length == 1 ) {
return Collections.singletonMap( entityKeyMetadata.getColumnNames()[0], (Object) key );
}
return strategy.deserialize( key, Map.class );
}
示例6: keyToMap
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
/**
* Deconstruct the key name into its components:
* Single key: Use the value from the key
* Multiple keys: De-serialize the JSON map.
*/
@SuppressWarnings("unchecked")
protected Map<String, String> keyToMap(EntityKeyMetadata entityKeyMetadata, String key) {
if ( entityKeyMetadata.getColumnNames().length == 1 ) {
return Collections.singletonMap( entityKeyMetadata.getColumnNames()[0], key );
}
return strategy.deserialize( key, Map.class );
}
示例7: forEachTuple
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
@Override
public void forEachTuple(final ModelConsumer consumer, TupleTypeContext tupleTypeContext, EntityKeyMetadata entityKeyMetadata) {
KeyScanCursor<String> cursor = null;
String prefix = entityKeyMetadata.getTable() + ":";
ScanArgs scanArgs = ScanArgs.Builder.matches( prefix + "*" );
do {
cursor = scan( cursor, scanArgs );
consumer.consume( new RedisJsonDialectTuplesSupplier( cursor, entityStorageStrategy, prefix, entityKeyMetadata ) );
} while ( !cursor.isFinished() );
}
示例8: forEachTuple
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
@Override
public void forEachTuple(ModelConsumer consumer, TupleTypeContext tupleTypeContext, EntityKeyMetadata entityKeyMetadata) {
KeyScanCursor<String> cursor = null;
String prefix = entityKeyMetadata.getTable() + ":";
ScanArgs scanArgs = ScanArgs.Builder.matches( prefix + "*" );
do {
cursor = scan( cursor, scanArgs );
consumer.consume( new RedisHashDialectTuplesSupplier( cursor, connection, prefix, entityKeyMetadata ) );
} while ( !cursor.isFinished() );
}
示例9: IgniteAssociationRowSnapshot
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
public IgniteAssociationRowSnapshot(Object id, BinaryObject binaryObject, AssociationKeyMetadata associationMetadata) {
this.id = id;
this.binaryObject = binaryObject;
this.associationMetadata = associationMetadata;
this.thirdTableLink = IgniteAssociationSnapshot.isThirdTableAssociation( associationMetadata );
if ( this.thirdTableLink ) {
Set<String> cn = new HashSet<>();
Collections.addAll( cn, associationMetadata.getRowKeyColumnNames() );
Collections.addAll( cn, associationMetadata.getAssociatedEntityKeyMetadata().getAssociationKeyColumns() );
this.columnNames = Collections.unmodifiableSet( cn );
this.isSimpleId = true; //vk: not used in this case
}
else {
Set<String> idColumnNames = new HashSet<>();
EntityKeyMetadata entityKeyMetadata = associationMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata();
for ( String columnName : entityKeyMetadata.getColumnNames() ) {
if ( entityKeyMetadata.isKeyColumn( columnName ) ) {
idColumnNames.add( columnName );
}
}
if ( idColumnNames.isEmpty() ) {
throw new UnsupportedOperationException( "There is no id column in entity " + entityKeyMetadata.getTable() + ". Hmm..." );
}
this.columnNames = CollectionHelper.asSet( entityKeyMetadata.getColumnNames() );
this.isSimpleId = idColumnNames.size() == 1;
}
}
示例10: findKeyType
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
/**
* Finds key type name for cache for entities with composite id
* @param keyMetadata
* @return
*/
private String findKeyType(EntityKeyMetadata keyMetadata) {
String result = compositeIdTypes.get( keyMetadata.getTable() );
if ( result == null ) {
String cacheType = getEntityTypeName( keyMetadata.getTable() );
IgniteCache<Object, BinaryObject> cache = getEntityCache( keyMetadata );
CacheConfiguration cacheConfig = cache.getConfiguration( CacheConfiguration.class );
if ( cacheConfig.getQueryEntities() != null ) {
for ( QueryEntity qe : (Collection<QueryEntity>) cacheConfig.getQueryEntities() ) {
if ( qe.getValueType() != null && cacheType.equalsIgnoreCase( qe.getValueType() ) ) {
result = qe.getKeyType();
break;
}
}
}
if ( result == null ) {
if ( cacheConfig.getKeyType() != null ) {
result = cacheConfig.getKeyType().getSimpleName();
}
if ( result == null ) {
// if nothing found we use id field name
result = StringHelper.stringBeforePoint( keyMetadata.getColumnNames()[0] );
result = StringUtils.capitalize( result );
}
}
compositeIdTypes.put( keyMetadata.getTable(), result );
}
return result;
}
示例11: extractEntityInfo
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
static LightblueEntityMetadataId extractEntityInfo(EntityKeyMetadata keyMetadata) {
Matcher entityVersionMatcher = LIGHTBLUE_TABLE_PATTERN.matcher(keyMetadata.getTable());
if (!entityVersionMatcher.matches()) {
throw new IllegalArgumentException("table does not match lightblue table format: {entityName}/{version}");
}
String entityVersion = entityVersionMatcher.group(3);
if (entityVersion == null || entityVersion.length() > 0) {
entityVersion = null;
}
return new LightblueEntityMetadataId(entityVersionMatcher.group(1), entityVersion);
}
示例12: LightblueTupleSnapshot
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
public LightblueTupleSnapshot(ObjectNode node, EntityKeyMetadata keyMetadata, OperationType operationType) {
this.node = node;
this.operationType = operationType;
LightblueEntityMetadataId metadataId = LightblueEntityMetadataId.extractEntityInfo(keyMetadata);
this.entityName = metadataId.entityName;
this.entityVersion = metadataId.entityVersion;
columnNames = findLeafNodeFieldNames("", node);
}
示例13: RedisJsonDialectTuplesSupplier
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
public RedisJsonDialectTuplesSupplier(KeyScanCursor<String> cursor, JsonEntityStorageStrategy storageStrategy, String prefix, EntityKeyMetadata entityKeyMetadata) {
this.cursor = cursor;
this.storageStrategy = storageStrategy;
this.prefix = prefix;
this.entityKeyMetadata = entityKeyMetadata;
}
示例14: RedisJsonTupleIterator
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
public RedisJsonTupleIterator(KeyScanCursor<String> cursor, JsonEntityStorageStrategy storageStrategy, String prefix, EntityKeyMetadata entityKeyMetadata) {
this.storageStrategy = storageStrategy;
this.prefix = prefix;
this.entityKeyMetadata = entityKeyMetadata;
this.iterator = cursor.getKeys().iterator();
}
示例15: RedisHashDialectTuplesSupplier
import org.hibernate.ogm.model.key.spi.EntityKeyMetadata; //导入依赖的package包/类
public RedisHashDialectTuplesSupplier(KeyScanCursor<String> cursor, RedisClusterCommands<String, String> connection, String prefix, EntityKeyMetadata entityKeyMetadata) {
this.cursor = cursor;
this.connection = connection;
this.prefix = prefix;
this.entityKeyMetadata = entityKeyMetadata;
}