本文整理了Java中org.hibernate.annotations.Cache
类的一些代码示例,展示了Cache
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache
类的具体详情如下:
包路径:org.hibernate.annotations.Cache
类名称:Cache
暂无
代码示例来源:origin: Raysmond/SpringBlog
/**
* A generic setting model
*
* @author Raysmond
*/
@Entity
@Table(name = "settings")
@Getter
@Setter
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "settingCache")
public class Setting extends BaseModel {
@Column(name = "_key", unique = true, nullable = false)
private String key;
@Lob
@Column(name = "_value")
private Serializable value;
}
代码示例来源:origin: hibernate/hibernate-orm
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;
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Entity( name="StateCodes" )
@Cache( region="com.acme.referenceData", usage = CacheConcurrencyStrategy.READ_WRITE )
public static class StateCodes {
@Id
public Integer id;
public StateCodes() {
}
public StateCodes(Integer id) {
this.id = id;
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONE)
public static class SimpleEntity extends AbstractMappedSuperclassWithGenericReturnValue<SimpleEntity.Type> {
public enum Type implements Marker {
ONE
}
}
}
代码示例来源:origin: Raysmond/SpringBlog
/**
* @author Raysmond
*/
@Entity
@Table(name = "tags")
@Getter
@Setter
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "tagCache")
public class Tag extends BaseModel {
@Column(nullable = false, unique = true)
private String name;
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "tags")
private List<Post> posts = new ArrayList<>();
public Tag() {
}
public Tag(String name) {
this.setName(name);
}
}
代码示例来源:origin: hibernate/hibernate-orm
@MappedSuperclass
@Cache(usage = CacheConcurrencyStrategy.NONE)
public static class AbstractMappedSuperclassWithGenericReturnValue<T extends Marker> {
@Id
@GeneratedValue
public int id;
@Access(AccessType.PROPERTY)
private T entity;
public T getEntity() {
return entity;
}
public void setEntity(T entity) {
this.entity = entity;
}
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
/**
* This class is meant as a template to provide overriding of the annotations on fields in
* <code>org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOptionImpl</code>. This provides a
* stop gap measure to allow someone to weave in the appropriate annotations in 4.0.x without forcing a schema change on those
* who prefer not to use it. This should likely be removed in 4.1 for fixed annotations on the entity itself.
*
* @author Kelly Tisdell
*
*/
@Deprecated
public abstract class OptionalEnterpriseBandedPriceFulfillmentOptionTemplate {
@OneToMany(mappedBy = "option", targetEntity = FulfillmentPriceBandImpl.class)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "blStandardElements")
@AdminPresentationCollection(friendlyName = "BandedPriceFulfillmentOptionBands", excluded = true)
protected List<FulfillmentPriceBand> bands = new ArrayList<FulfillmentPriceBand>();
}
代码示例来源:origin: hibernate/hibernate-orm
cacheConcurrentStrategy = resolveCacheConcurrencyStrategy( effectiveCacheAnn.usage() );
cacheRegion = effectiveCacheAnn.region();
switch ( effectiveCacheAnn.include().toLowerCase( Locale.ROOT ) ) {
case "all": {
cacheLazyProperty = true;
"Unknown @Cache.include value [" + effectiveCacheAnn.include() + "] : "
+ annotatedClass.getName()
);
if ( naturalIdCacheAnn != null ) {
if ( BinderHelper.isEmptyAnnotationValue( naturalIdCacheAnn.region() ) ) {
if ( explicitCacheAnn != null && StringHelper.isNotEmpty( explicitCacheAnn.region() ) ) {
naturalIdCacheRegion = explicitCacheAnn.region() + NATURAL_ID_CACHE_SUFFIX;
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
LOG.info("Cache invalidation event to be sent");
LOG.info("superclazz : " + superclazz.getName());
LOG.info("region : " + cacheAnnotation.region());
LOG.info("id : " + id);
detailMap.put("CACHE_REGION", new BroadleafSystemEventDetail("Cache Region", cacheAnnotation.region()));
detailMap.put("ENTITY_TYPE", new BroadleafSystemEventDetail("Entity Type", superclazz.getName()));
detailMap.put("IDENTIFIER", new BroadleafSystemEventDetail("Identifier", id));
代码示例来源:origin: hibernate/hibernate-orm
@Entity( name = "ZipCodes" )
@Cache( region="com.acme.referenceData", usage = CacheConcurrencyStrategy.READ_WRITE )
public static class ZipCodes {
@Id
public Integer id;
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Entity(name = "FileBlob")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
public static class FileBlob {
private int id;
private Blob blob;
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column(name = "filedata", length = 1024 * 1024)
@Lob
@Basic(fetch = FetchType.LAZY)
public Blob getBlob() {
return blob;
}
public void setBlob(Blob blob) {
this.blob = blob;
}
}
代码示例来源:origin: Raysmond/SpringBlog
@Entity
@Table(name = "users")
@Getter
@Setter
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "userCache")
public class User extends BaseModel {
public static final String ROLE_ADMIN = "ROLE_ADMIN";
代码示例来源:origin: org.hibernate/hibernate-annotations
public void setCache(Cache cacheAnn) {
if ( cacheAnn != null ) {
cacheRegion = BinderHelper.isDefault( 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;
}
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
/**
*
* @author jfischer
*
*/
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "BLC_DYN_DISCRETE_ORDER_ITEM")
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region="blOrderElements")
@AdminPresentationClass(friendlyName = "DynamicPriceDiscreteOrderItemImpl_dynamicPriceOrderItem")
public class DynamicPriceDiscreteOrderItemImpl extends DiscreteOrderItemImpl implements DynamicPriceDiscreteOrderItem {
private static final long serialVersionUID = 1L;
@Override
public void setSku(Sku sku) {
this.sku = sku;
this.name = sku.getName();
}
@Override
public boolean updateSaleAndRetailPrices() {
return false;
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Entity(name = "Person")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public static class Person {
@Id
private Long id;
private String name;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Entity(name = "FileClob")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
public static class FileClob {
private int id;
private Clob clob;
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column(name = "filedata", length = 1024 * 1024)
@Lob
@Basic(fetch = FetchType.LAZY)
public Clob getClob() {
return clob;
}
public void setClob(Clob clob) {
this.clob = clob;
}
}
代码示例来源:origin: org.hibernate/hibernate-annotations
public void setCache(Cache cacheAnn) {
if ( cacheAnn != null ) {
cacheRegionName = BinderHelper.isDefault( cacheAnn.region() ) ? null : cacheAnn.region();
cacheConcurrencyStrategy = EntityBinder.getCacheConcurrencyStrategy( cacheAnn.usage() );
}
else {
cacheConcurrencyStrategy = null;
cacheRegionName = null;
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
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;
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Entity(name = "Event")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public static class Event {
@Id
@GeneratedValue
private Long id;
}
代码示例来源:origin: hibernate/hibernate-orm
@Entity
public class Company {
@Id
int id;
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
List<User> users = new ArrayList<User>();
内容来源于网络,如有侵权,请联系作者删除!