當前位置: 首頁>>代碼示例>>Java>>正文


Java AssociationStorageType類代碼示例

本文整理匯總了Java中org.hibernate.ogm.datastore.document.options.AssociationStorageType的典型用法代碼示例。如果您正苦於以下問題:Java AssociationStorageType類的具體用法?Java AssociationStorageType怎麽用?Java AssociationStorageType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AssociationStorageType類屬於org.hibernate.ogm.datastore.document.options包,在下文中一共展示了AssociationStorageType類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ttlOnPropertyLevel

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Test
public void ttlOnPropertyLevel() throws Exception {
	Map<String, Object> settings = new HashMap<String, Object>();

	TestHelper.configureOptionsFor( settings, Redis.class )
			.associationStorage( AssociationStorageType.ASSOCIATION_DOCUMENT )
			.entity( Cloud.class )
			.property( "backupSnowFlakes", ElementType.METHOD )
			.ttl( 1, TimeUnit.DAYS );

	setupSessionFactory( settings );
	createCloudWithTwoProducedAndOneBackupSnowflake();

	// property-level options are applied to the type as well.
	// not sure, whether this is a good idea.
	assertThat( cloudTtl() ).isGreaterThan( TimeUnit.HOURS.toMillis( 23 ) )
			.isLessThanOrEqualTo( TimeUnit.HOURS.toMillis( 24 ) );

	assertThat( associationTtl() ).isGreaterThan( TimeUnit.HOURS.toMillis( 23 ) )
			.isLessThanOrEqualTo( TimeUnit.HOURS.toMillis( 24 ) );
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:22,代碼來源:TTLConfiguredProgrammaticallyTest.java

示例2: getNumberOfAssociations

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Override
public long getNumberOfAssociations(SessionFactory sessionFactory, AssociationStorageType type) {
	int asscociationCount = 0;
	Set<IgniteCache<Object, BinaryObject>> processedCaches = Collections.newSetFromMap( new IdentityHashMap<IgniteCache<Object, BinaryObject>, Boolean>() );

	for ( CollectionPersister collectionPersister : ( (SessionFactoryImplementor) sessionFactory ).getCollectionPersisters().values() ) {
		AssociationKeyMetadata associationKeyMetadata = ( (OgmCollectionPersister) collectionPersister ).getAssociationKeyMetadata();
		IgniteCache<Object, BinaryObject> associationCache = getAssociationCache( sessionFactory, associationKeyMetadata );
		if ( !processedCaches.contains( associationCache ) ) {
			asscociationCount += associationCache.size();
			processedCaches.add( associationCache );
		}
	}

	return asscociationCount;
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-ignite,代碼行數:17,代碼來源:IgniteTestHelper.java

示例3: isStoredInEntityStructure

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Override
public boolean isStoredInEntityStructure(
		AssociationKeyMetadata keyMetadata,
		AssociationTypeContext associationTypeContext) {

	AssociationStorageType associationStorage = getAssociationStorageType( associationTypeContext );

	if ( keyMetadata.getAssociationType() == AssociationType.ONE_TO_ONE || keyMetadata.getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION || associationStorage == AssociationStorageType.IN_ENTITY ) {
		return true;
	}

	return false;
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:14,代碼來源:RedisJsonDialect.java

示例4: getNumberOfAssociations

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Override
public long getNumberOfAssociations(SessionFactory sessionFactory, AssociationStorageType type) {
	switch ( type ) {
		case ASSOCIATION_DOCUMENT:
			return getNumberOfGlobalAssociations( sessionFactory );
		case IN_ENTITY:
			return getNumberOfEmbeddedAssociations( sessionFactory );
		default:
			throw new IllegalArgumentException( "Unexpected association storaget type " + type );
	}
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:12,代碼來源:RedisTestHelper.java

示例5: configure

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Override
protected void configure(Map<String, Object> cfg) {
	super.configure( cfg );
	cfg.put(
			DocumentStoreProperties.ASSOCIATIONS_STORE,
			AssociationStorageType.ASSOCIATION_DOCUMENT
	);
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:9,代碼來源:GlobalPropertyTTLTest.java

示例6: configure

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Override
protected void configure(Map<String, Object> cfg) {
	super.configure( cfg );
	cfg.put(
			DocumentStoreProperties.ASSOCIATIONS_STORE,
			AssociationStorageType.IN_ENTITY
	);
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:9,代碼來源:ManyToManyInEntityTest.java

示例7: associationStorage

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Override
public RedisPropertyContext associationStorage(AssociationStorageType associationStorageType) {
	Contracts.assertParameterNotNull( associationStorageType, "associationStorageType" );
	addPropertyOption( new AssociationStorageOption(), associationStorageType );
	return this;
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:7,代碼來源:RedisPropertyContextImpl.java

示例8: associationStorage

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Override
public RedisEntityContext associationStorage(AssociationStorageType associationStorageType) {
	Contracts.assertParameterNotNull( associationStorageType, "associationStorageType" );
	addEntityOption( new AssociationStorageOption(), associationStorageType );
	return this;
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:7,代碼來源:RedisEntityContextImpl.java

示例9: associationStorage

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Override
public RedisGlobalContext associationStorage(AssociationStorageType associationStorageType) {
	Contracts.assertParameterNotNull( associationStorageType, "associationStorageType" );
	addGlobalOption( new AssociationStorageOption(), associationStorageType );
	return this;
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:7,代碼來源:RedisGlobalContextImpl.java

示例10: getAssociationStorageType

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
private AssociationStorageType getAssociationStorageType(AssociationTypeContext associationTypeContext) {
	return associationTypeContext.getOptionsContext().getUnique(
			AssociationStorageOption.class
	);
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:6,代碼來源:RedisJsonDialect.java

示例11: configure

import org.hibernate.ogm.datastore.document.options.AssociationStorageType; //導入依賴的package包/類
@Override
protected void configure(GetterPersistenceUnitInfo info) {
	super.configure( info );
	info.getProperties()
			.put( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.IN_ENTITY );
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:7,代碼來源:CompositeIdInEmbeddedTest.java


注:本文中的org.hibernate.ogm.datastore.document.options.AssociationStorageType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。