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


Java CacheConcurrencyStrategy類代碼示例

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


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

示例1: prepareDefaultCacheConcurrencyStrategy

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
static void prepareDefaultCacheConcurrencyStrategy(Properties properties) {
	if ( DEFAULT_CACHE_CONCURRENCY_STRATEGY != null ) {
		LOG.trace( "Default cache concurrency strategy already defined" );
		return;
	}

	if ( !properties.containsKey( AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY ) ) {
		LOG.trace( "Given properties did not contain any default cache concurrency strategy setting" );
		return;
	}

	final String strategyName = properties.getProperty( AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY );
	LOG.tracev( "Discovered default cache concurrency strategy via config [{0}]", strategyName );
	CacheConcurrencyStrategy strategy = CacheConcurrencyStrategy.parse( strategyName );
	if ( strategy == null ) {
		LOG.trace( "Discovered default cache concurrency strategy specified nothing" );
		return;
	}

	LOG.debugf( "Setting default cache concurrency strategy via config [%s]", strategy.name() );
	DEFAULT_CACHE_CONCURRENCY_STRATEGY = strategy;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:AnnotationBinder.java

示例2: getAnswers

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
/**
 * @return answers all possible answers of a question of given type
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "questionType", cascade=CascadeType.ALL, orphanRemoval=true)
@IndexColumn(name = "sort_order")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public List<Answer> getAnswers() {
	return this.answers;
}
 
開發者ID:MobileManAG,項目名稱:Project-H-Backend,代碼行數:10,代碼來源:QuestionType.java

示例3: init

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
public static void init() {
    Map<String, Object> props = new HashMap<String, Object>();
    props.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, true);
    props.put(AvailableSettings.USE_QUERY_CACHE, true);
    props.put(AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY, CacheConcurrencyStrategy.NONSTRICT_READ_WRITE);
    props.put(AvailableSettings.CACHE_REGION_FACTORY, Hibernate4MemcachedRegionFactory.class.getName());
    props.put(AvailableSettings.CACHE_REGION_PREFIX, "cachetest");
    props.put(AvailableSettings.CACHE_PROVIDER_CONFIG, "META-INF/h4m-properties.xml");
    props.put(AvailableSettings.HBM2DDL_AUTO, "create");
    props.put(AvailableSettings.USE_STRUCTURED_CACHE, "false");
    props.put(Hibernate4MemcachedRegionFactory.MEMCACHED_ADAPTER_CLASS_PROPERTY_KEY,
            SpyMemcachedAdapter.class.getName());
    props.put(SpyMemcachedAdapter.HOST_PROPERTY_KEY, "localhost:11211");
    props.put(SpyMemcachedAdapter.HASH_ALGORITHM_PROPERTY_KEY, DefaultHashAlgorithm.KETAMA_HASH.name());
    props.put(SpyMemcachedAdapter.OPERATION_TIMEOUT_MILLIS_PROPERTY_KEY, "5000");
    props.put(SpyMemcachedAdapter.TRANSCODER_PROPERTY_KEY, KryoTranscoder.class.getName());
    props.put(SpyMemcachedAdapter.CACHE_KEY_PREFIX_PROPERTY_KEY, "h4m");
    props.put(KryoTranscoder.COMPRESSION_THREASHOLD_PROPERTY_KEY, "20000");

    emf = Persistence.createEntityManagerFactory("cachetest", props);
}
 
開發者ID:kwon37xi,項目名稱:hibernate4-memcached,代碼行數:22,代碼來源:EntityTestUtils.java

示例4: determineCacheConcurrencyStrategy

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
private static CacheConcurrencyStrategy determineCacheConcurrencyStrategy(Mappings mappings) {
	if ( DEFAULT_CACHE_CONCURRENCY_STRATEGY == null ) {
		final RegionFactory cacheRegionFactory = SettingsFactory.createRegionFactory(
				mappings.getConfigurationProperties(), true
		);
		DEFAULT_CACHE_CONCURRENCY_STRATEGY = CacheConcurrencyStrategy.fromAccessType( cacheRegionFactory.getDefaultAccessType() );
	}
	return DEFAULT_CACHE_CONCURRENCY_STRATEGY;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:AnnotationBinder.java

示例5: getBadges

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
@ManyToMany
@JoinTable(name = "user_badge", joinColumns = { @JoinColumn(name = "user_id") }, inverseJoinColumns = { @JoinColumn(name = "badge_id") })
@Fetch(FetchMode.SUBSELECT)
@OrderBy("id")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public Set<Badge> getBadges() {
	return badges;
}
 
開發者ID:muzili90,項目名稱:SpringBBS,代碼行數:9,代碼來源:AcctUser.java

示例6: getRoleList

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
@ManyToMany
//�м����,��������Ĭ����������
@JoinTable(name = "ACCT_USER_ROLE", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") })
//Fecth���Զ���
@Fetch(FetchMode.SUBSELECT)
//���ϰ�id����.
@OrderBy("id")
//�����ж���id�Ļ���.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public List<AcctRole> getRoleList() {
	return roleList;
}
 
開發者ID:muzili90,項目名稱:SpringBBS,代碼行數:13,代碼來源:AcctUser.java

示例7: getPersistenceClasses

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
@Override
   public PersistenceClass[] getPersistenceClasses() {

final List<PersistenceClass> lpc = new ArrayList<PersistenceClass>();

// First add all bean classes that needs cache concurrency mode
// read/write
lpc.addAll(PersistenceClass.createBeans(new Class[] { Blacklist.class,
	BlacklistType.class }, CacheConcurrencyStrategy.READ_WRITE));

// Some persistence class instances are updated rarely therefore use
// NONSTRICT_READ_WRITE
lpc.addAll(PersistenceClass.createBeans(new Class[] {},
	CacheConcurrencyStrategy.NONSTRICT_READ_WRITE));

// special handling for non chached collection
lpc.addAll(PersistenceClass.createBeans(new Class[] {},
	CacheConcurrencyStrategy.NONSTRICT_READ_WRITE,
	CacheConcurrencyStrategy.NONE));

lpc.addAll(PersistenceClass.createBeans(new Class[] {},
	CacheConcurrencyStrategy.NONE));

// Some persistence class instances are never updated. These can use
// the concurrency strategy READ

lpc.addAll(PersistenceClass.createBeans(new Class[] {},
	CacheConcurrencyStrategy.READ_ONLY));

// in case the superclass is already cached it is not allowed to set a
// cache concurrency strategy on any children!!
lpc.addAll(PersistenceClass.createBeans(new Class[] {}, null));

return lpc.toArray(new PersistenceClass[lpc.size()]);
   }
 
開發者ID:SAP,項目名稱:smp_mobiliser_template,代碼行數:36,代碼來源:MobiliserHibernateBeans.java

示例8: getStreet

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
/**
    * The GisFeature, the Alternate name refers to
    * 
    * @return the GisFeature, the AlternateName refers to
    */
   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(nullable = false, name = "street")
   @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
   @Index(name = "Alternatenameosmnameindex")
   public OpenStreetMap getStreet() {
return street;
   }
 
開發者ID:gisgraphy,項目名稱:gisgraphy,代碼行數:13,代碼來源:AlternateOsmName.java

示例9: getChildren

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
/**
    * Return the Adms of a directly higher Level in the adm the tree structure
    * @return The Adms of a directly higher Level <br>
    * <b>Example</b> Returns the Adm(s) with level 2 if the current
    *         Adm has a level equals to 1
    */
   @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "parent")
   @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
   @Fetch(FetchMode.SELECT)
   public List<Adm> getChildren() {
return children;
   }
 
開發者ID:gisgraphy,項目名稱:gisgraphy,代碼行數:13,代碼來源:Adm.java

示例10: getParent

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
/**
    * Returns The parent Adm in the Adm tree structure
    * 
    * @return The parent Adm (with lower Level)
    */
   @ManyToOne(fetch = FetchType.EAGER)
   @JoinColumn(nullable = true, name = "parent")
   @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
   @Index(name = "admadmindex")
   public Adm getParent() {
return parent;
   }
 
開發者ID:gisgraphy,項目名稱:gisgraphy,代碼行數:13,代碼來源:Adm.java

示例11: getAlternateNames

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
/**
 * @return A list of the {@link AlternateName}s for this street
 */
@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "street")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Fetch(FetchMode.SELECT)
public List<AlternateOsmName> getAlternateNames() {
	return alternateNames;
}
 
開發者ID:gisgraphy,項目名稱:gisgraphy,代碼行數:10,代碼來源:OpenStreetMap.java

示例12: getHouseNumbers

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
/**
 * @return the houseNumbers associated to that street
 */
@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "street")
   @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
   @Fetch(FetchMode.SELECT)
@Sort(comparator=HouseNumberComparator.class,type=SortType.COMPARATOR)
public SortedSet<HouseNumber> getHouseNumbers() {
	return houseNumbers;
}
 
開發者ID:gisgraphy,項目名稱:gisgraphy,代碼行數:11,代碼來源:OpenStreetMap.java

示例13: getGisFeature

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
/**
    * @return the gisFeature associated to this zip code
    */
   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(nullable = true, name = "gisFeature")
   @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
   @Index(name = "zipcodefeatureidindex")
   public GisFeature getGisFeature() {
return this.gisFeature;
   }
 
開發者ID:gisgraphy,項目名稱:gisgraphy,代碼行數:11,代碼來源:ZipCode.java

示例14: getStreet

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
/**
 * @return the street associated to this house number
 */
 @ManyToOne(fetch = FetchType.LAZY)//TODO HN
 @JoinColumn(nullable = false, name = "street")
 @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
 @Index(name = "housenumberstreetindex")
public OpenStreetMap getStreet() {
	return street;
}
 
開發者ID:gisgraphy,項目名稱:gisgraphy,代碼行數:11,代碼來源:HouseNumber.java

示例15: getAdm

import org.hibernate.annotations.CacheConcurrencyStrategy; //導入依賴的package包/類
/**
    * @return The Adm with the higher Level that this GisFeature is linked to
    *         (the deeper in the Adm tree). See Important Notes for admXcode
    *         for {@link GisFeature}
    */
   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "adm", unique = false, referencedColumnName = "id", nullable = true)
   @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
   @Index(name = "gisfeatureadmindex")
   public Adm getAdm() {
return adm;
   }
 
開發者ID:gisgraphy,項目名稱:gisgraphy,代碼行數:13,代碼來源:GisFeature.java


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