本文整理汇总了Java中org.hibernate.ogm.model.key.spi.EntityKeyMetadata.getColumnNames方法的典型用法代码示例。如果您正苦于以下问题:Java EntityKeyMetadata.getColumnNames方法的具体用法?Java EntityKeyMetadata.getColumnNames怎么用?Java EntityKeyMetadata.getColumnNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.ogm.model.key.spi.EntityKeyMetadata
的用法示例。
在下文中一共展示了EntityKeyMetadata.getColumnNames方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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() );
}
示例2: 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 );
}
示例3: 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 );
}
示例4: 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;
}
}