本文整理匯總了Java中org.hibernate.annotations.Cache類的典型用法代碼示例。如果您正苦於以下問題:Java Cache類的具體用法?Java Cache怎麽用?Java Cache使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Cache類屬於org.hibernate.annotations包,在下文中一共展示了Cache類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setCache
import org.hibernate.annotations.Cache; //導入依賴的package包/類
public void setCache(Cache cacheAnn) {
if ( cacheAnn != null ) {
cacheRegion = BinderHelper.isEmptyAnnotationValue( cacheAnn.region() ) ?
null :
cacheAnn.region();
cacheConcurrentStrategy = getCacheConcurrencyStrategy( cacheAnn.usage() );
if ( "all".equalsIgnoreCase( cacheAnn.include() ) ) {
cacheLazyProperty = true;
}
else if ( "non-lazy".equalsIgnoreCase( cacheAnn.include() ) ) {
cacheLazyProperty = false;
}
else {
throw new AnnotationException( "Unknown lazy property annotations: " + cacheAnn.include() );
}
}
else {
cacheConcurrentStrategy = null;
cacheRegion = null;
cacheLazyProperty = true;
}
}
示例2: visitAnnotation
import org.hibernate.annotations.Cache; //導入依賴的package包/類
public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) {
Type annotationType = Type.getType(arg0);
switch(stage) {
case CLASSSTAGE: {
if (annotationType.getClassName().equals(Cache.class.getName())){
annotation = Cache.class.getName();
}
break;
}
case FIELDSTAGE: {
if (annotationType.getClassName().equals(Id.class.getName())){
idMutators.put(fieldName, retrieveMutators());
}
if (annotationType.getClassName().equals(Hydrated.class.getName())){
annotation = Hydrated.class.getName();
}
break;
}
default : {
annotation = null;
fieldName = null;
break;
}
}
return this;
}
示例3: getInheritanceHierarchyRoot
import org.hibernate.annotations.Cache; //導入依賴的package包/類
private static String getInheritanceHierarchyRoot(Class<?> myEntityClass) {
String myEntityName = myEntityClass.getName();
if (inheritanceHierarchyRoots.containsKey(myEntityName)) {
return inheritanceHierarchyRoots.get(myEntityName);
}
Class<?> currentClass = myEntityClass;
boolean eof = false;
while (!eof) {
Class<?> superclass = currentClass.getSuperclass();
if (superclass.equals(Object.class) || !superclass.isAnnotationPresent(Entity.class)) {
eof = true;
} else {
currentClass = superclass;
}
}
if (!currentClass.isAnnotationPresent(Cache.class)) {
currentClass = myEntityClass;
}
inheritanceHierarchyRoots.put(myEntityName, currentClass.getName());
return inheritanceHierarchyRoots.get(myEntityName);
}
示例4: getAnswers
import org.hibernate.annotations.Cache; //導入依賴的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;
}
示例5: visit
import org.hibernate.annotations.Cache; //導入依賴的package包/類
public void visit(String arg0, Object arg1) {
if (Cache.class.getName().equals(annotation) && "region".equals(arg0)) {
cacheRegion = (String) arg1;
}
if (Hydrated.class.getName().equals(annotation) && "factoryMethod".equals(arg0)) {
HydrationItemDescriptor itemDescriptor = new HydrationItemDescriptor();
itemDescriptor.setFactoryMethod((String) arg1);
itemDescriptor.setMutators(retrieveMutators());
cacheMutators.put(fieldName, itemDescriptor);
}
}
示例6: determineCacheSettings
import org.hibernate.annotations.Cache; //導入依賴的package包/類
private static Cache determineCacheSettings(XClass clazzToProcess, Mappings mappings) {
Cache cacheAnn = clazzToProcess.getAnnotation( Cache.class );
if ( cacheAnn != null ) {
return cacheAnn;
}
Cacheable cacheableAnn = clazzToProcess.getAnnotation( Cacheable.class );
SharedCacheMode mode = determineSharedCacheMode( mappings );
switch ( mode ) {
case ALL: {
cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
break;
}
case ENABLE_SELECTIVE: {
if ( cacheableAnn != null && cacheableAnn.value() ) {
cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
}
break;
}
case DISABLE_SELECTIVE: {
if ( cacheableAnn == null || cacheableAnn.value() ) {
cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
}
break;
}
default: {
// treat both NONE and UNSPECIFIED the same
break;
}
}
return cacheAnn;
}
示例7: setCache
import org.hibernate.annotations.Cache; //導入依賴的package包/類
public void setCache(Cache cacheAnn) {
if ( cacheAnn != null ) {
cacheRegionName = BinderHelper.isEmptyAnnotationValue( cacheAnn.region() ) ? null : cacheAnn.region();
cacheConcurrencyStrategy = EntityBinder.getCacheConcurrencyStrategy( cacheAnn.usage() );
}
else {
cacheConcurrencyStrategy = null;
cacheRegionName = null;
}
}
示例8: getBadges
import org.hibernate.annotations.Cache; //導入依賴的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;
}
示例9: getRoleList
import org.hibernate.annotations.Cache; //導入依賴的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;
}
示例10: getStreet
import org.hibernate.annotations.Cache; //導入依賴的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;
}
示例11: getChildren
import org.hibernate.annotations.Cache; //導入依賴的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;
}
示例12: getParent
import org.hibernate.annotations.Cache; //導入依賴的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;
}
示例13: getAlternateNames
import org.hibernate.annotations.Cache; //導入依賴的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;
}
示例14: getHouseNumbers
import org.hibernate.annotations.Cache; //導入依賴的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;
}
示例15: getGisFeature
import org.hibernate.annotations.Cache; //導入依賴的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;
}