#684 - Refactor - rename @CacheStrategy to @Cache ... require explicit enableQueryCache=true for query cache use

This commit is contained in:
Robin Bygrave
2016-04-29 21:52:50 +12:00
parent a6d276d4d3
commit 5bcfce9cd4
63 changed files with 719 additions and 844 deletions
@@ -1,6 +1,6 @@
package com.avaje.tests.model.basic;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
import com.avaje.ebean.annotation.CacheBeanTuning;
import javax.persistence.CascadeType;
@@ -10,7 +10,7 @@ import java.util.ArrayList;
import java.util.List;
@CacheStrategy
@Cache
@CacheBeanTuning(maxSecsToLive = 45)
@Entity
public class Article extends BasicDomain {
@@ -1,6 +1,6 @@
package com.avaje.tests.model.basic;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
import com.avaje.ebean.annotation.ChangeLog;
import com.avaje.ebean.annotation.CreatedTimestamp;
import com.avaje.ebean.annotation.DocEmbedded;
@@ -17,136 +17,134 @@ import java.sql.Timestamp;
import java.util.List;
@DocStore
@Index(columnNames = {"last_name","first_name"})
@Index(columnNames = {"last_name", "first_name"})
@ChangeLog
@Entity
@CacheStrategy(naturalKey="email")
@Cache(naturalKey = "email")
public class Contact {
private static final long serialVersionUID = 1L;
@Id
int id;
@Id
int id;
String firstName;
String lastName;
String firstName;
String lastName;
String phone;
String mobile;
String email;
String phone;
String mobile;
String email;
@DocEmbedded(doc = "id,name")
@ManyToOne(optional = false)
Customer customer;
@DocEmbedded(doc="id,name")
@ManyToOne(optional=false)
Customer customer;
@ManyToOne(optional=true)
ContactGroup group;
@OneToMany(cascade = CascadeType.ALL)
List<ContactNote> notes;
@ManyToOne(optional = true)
ContactGroup group;
@CreatedTimestamp
Timestamp cretime;
@OneToMany(cascade = CascadeType.ALL)
List<ContactNote> notes;
@Version
Timestamp updtime;
@CreatedTimestamp
Timestamp cretime;
@Version
Timestamp updtime;
public Contact(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public Contact(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public Contact() {
public Contact() {
}
}
public int getId() {
return id;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public void setId(int id) {
this.id = id;
}
public Timestamp getUpdtime() {
return updtime;
}
public Timestamp getUpdtime() {
return updtime;
}
public void setUpdtime(Timestamp updtime) {
this.updtime = updtime;
}
public void setUpdtime(Timestamp updtime) {
this.updtime = updtime;
}
public Timestamp getCretime() {
return cretime;
}
public Timestamp getCretime() {
return cretime;
}
public void setCretime(Timestamp cretime) {
this.cretime = cretime;
}
public void setCretime(Timestamp cretime) {
this.cretime = cretime;
}
public String getFirstName() {
return firstName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhone() {
return phone;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getMobile() {
return mobile;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public void setEmail(String email) {
this.email = email;
}
public Customer getCustomer() {
return customer;
}
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public ContactGroup getGroup() {
return group;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public void setGroup(ContactGroup group) {
this.group = group;
}
public ContactGroup getGroup() {
return group;
}
public List<ContactNote> getNotes() {
return notes;
}
public void setGroup(ContactGroup group) {
this.group = group;
}
public void setNotes(List<ContactNote> notes) {
this.notes = notes;
}
public List<ContactNote> getNotes() {
return notes;
}
public void setNotes(List<ContactNote> notes) {
this.notes = notes;
}
}
@@ -1,6 +1,6 @@
package com.avaje.tests.model.basic;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
import com.avaje.ebean.annotation.CacheBeanTuning;
import com.avaje.ebean.annotation.ChangeLog;
import com.avaje.ebean.annotation.ChangeLogInsertMode;
@@ -18,7 +18,7 @@ import javax.validation.constraints.Size;
@DocStore
@ReadAudit
@ChangeLog(inserts = ChangeLogInsertMode.INCLUDE)
@CacheStrategy(readOnly = true)
@Cache(readOnly = true, enableQueryCache = true)
@CacheBeanTuning(maxSize = 500)
@Entity
@Table(name = "o_country")
@@ -1,5 +1,6 @@
package com.avaje.tests.model.basic;
import com.avaje.ebean.annotation.Cache;
import com.avaje.ebean.annotation.ChangeLog;
import com.avaje.ebean.annotation.ChangeLogInsertMode;
import com.avaje.ebean.annotation.DbComment;
@@ -26,6 +27,7 @@ import java.util.concurrent.locks.ReentrantLock;
/**
* Customer entity bean.
*/
@Cache(enableQueryCache = true)
@DocStore
@ChangeLog(inserts = ChangeLogInsertMode.EXCLUDE, updatesThatInclude = {"name","status"})
@Entity
@@ -1,5 +1,6 @@
package com.avaje.tests.model.basic;
import com.avaje.ebean.annotation.Cache;
import com.avaje.ebean.annotation.ChangeLog;
import com.avaje.ebean.annotation.ReadAudit;
import com.avaje.ebean.annotation.WhenCreated;
@@ -13,6 +14,7 @@ import javax.persistence.Version;
import javax.validation.constraints.Size;
import java.sql.Timestamp;
@Cache(enableQueryCache = true)
@ReadAudit
@ChangeLog(updatesThatInclude = {"name","shortDescription"})
@Entity
@@ -1,5 +1,7 @@
package com.avaje.tests.model.basic;
import com.avaje.ebean.annotation.Cache;
import java.sql.Timestamp;
import javax.persistence.Entity;
@@ -7,6 +9,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
@Cache(enableQueryCache = true)
@Entity
@Table(name = "e_basicver")
public class EBasicVer {
@@ -4,9 +4,9 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
@CacheStrategy(readOnly = true, useBeanCache = true)
@Cache(readOnly = true)
@Entity
@Table(name="feature_desc")
public class FeatureDescription {
@@ -10,12 +10,12 @@ import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
/**
* Cached bean for testing caching implementation.
*/
@CacheStrategy
@Cache
@Entity
@Table(name = "o_cached_bean")
public class OCachedBean {
@@ -5,12 +5,12 @@ import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
/**
* Cached bean for testing caching implementation, especially relations.
*/
@CacheStrategy
@Cache
@Entity
@Table(name = "o_cached_bean_child")
public class OCachedBeanChild {
@@ -1,5 +1,6 @@
package com.avaje.tests.model.basic;
import com.avaje.ebean.annotation.Cache;
import com.avaje.ebean.annotation.ChangeLog;
import com.avaje.ebean.annotation.DocEmbedded;
import com.avaje.ebean.annotation.DocStore;
@@ -30,6 +31,7 @@ import java.util.List;
/**
* Order entity bean.
*/
@Cache
@DocStore
@ChangeLog
@Entity
@@ -1,5 +1,6 @@
package com.avaje.tests.model.basic;
import com.avaje.ebean.annotation.Cache;
import com.avaje.ebean.annotation.DocEmbedded;
import javax.persistence.Entity;
@@ -13,146 +14,147 @@ import java.sql.Timestamp;
/**
* Order Detail entity bean.
*/
@Cache
@Entity
@Table(name = "o_order_detail")
public class OrderDetail implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@Id
Integer id;
@Id
Integer id;
@ManyToOne(optional = false)
Order order;
@ManyToOne(optional = false)
Order order;
Integer orderQty;
Integer orderQty;
Integer shipQty;
Integer shipQty;
Double unitPrice;
Double unitPrice;
@ManyToOne
@DocEmbedded(doc = "id,name,sku")
Product product;
@ManyToOne
@DocEmbedded(doc = "id,name,sku")
Product product;
Timestamp cretime;
Timestamp cretime;
@Version
Timestamp updtime;
@Version
Timestamp updtime;
public OrderDetail() {
}
public OrderDetail() {
}
public OrderDetail(Product product, Integer orderQty, Double unitPrice) {
this.product = product;
this.orderQty = orderQty;
this.unitPrice = unitPrice;
}
public OrderDetail(Product product, Integer orderQty, Double unitPrice) {
this.product = product;
this.orderQty = orderQty;
this.unitPrice = unitPrice;
}
/**
* Return id.
*/
public Integer getId() {
return id;
}
/**
* Return id.
*/
public Integer getId() {
return id;
}
/**
* Set id.
*/
public void setId(Integer id) {
this.id = id;
}
/**
* Set id.
*/
public void setId(Integer id) {
this.id = id;
}
/**
* Return order qty.
*/
public Integer getOrderQty() {
return orderQty;
}
/**
* Return order qty.
*/
public Integer getOrderQty() {
return orderQty;
}
/**
* Set order qty.
*/
public void setOrderQty(Integer orderQty) {
this.orderQty = orderQty;
}
/**
* Set order qty.
*/
public void setOrderQty(Integer orderQty) {
this.orderQty = orderQty;
}
/**
* Return ship qty.
*/
public Integer getShipQty() {
return shipQty;
}
/**
* Return ship qty.
*/
public Integer getShipQty() {
return shipQty;
}
/**
* Set ship qty.
*/
public void setShipQty(Integer shipQty) {
this.shipQty = shipQty;
}
/**
* Set ship qty.
*/
public void setShipQty(Integer shipQty) {
this.shipQty = shipQty;
}
public Double getUnitPrice() {
return unitPrice;
}
public Double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
/**
* Return cretime.
*/
public Timestamp getCretime() {
return cretime;
}
/**
* Return cretime.
*/
public Timestamp getCretime() {
return cretime;
}
/**
* Set cretime.
*/
public void setCretime(Timestamp cretime) {
this.cretime = cretime;
}
/**
* Set cretime.
*/
public void setCretime(Timestamp cretime) {
this.cretime = cretime;
}
/**
* Return updtime.
*/
public Timestamp getUpdtime() {
return updtime;
}
/**
* Return updtime.
*/
public Timestamp getUpdtime() {
return updtime;
}
/**
* Set updtime.
*/
public void setUpdtime(Timestamp updtime) {
this.updtime = updtime;
}
/**
* Set updtime.
*/
public void setUpdtime(Timestamp updtime) {
this.updtime = updtime;
}
/**
* Return order.
*/
public Order getOrder() {
return order;
}
/**
* Return order.
*/
public Order getOrder() {
return order;
}
/**
* Set order.
*/
public void setOrder(Order order) {
this.order = order;
}
/**
* Set order.
*/
public void setOrder(Order order) {
this.order = order;
}
/**
* Return product.
*/
public Product getProduct() {
return product;
}
/**
* Return product.
*/
public Product getProduct() {
return product;
}
/**
* Set product.
*/
public void setProduct(Product product) {
this.product = product;
}
/**
* Set product.
*/
public void setProduct(Product product) {
this.product = product;
}
}
@@ -10,7 +10,7 @@ import javax.persistence.Version;
import javax.validation.constraints.Size;
import com.avaje.ebean.annotation.CacheQueryTuning;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
import com.avaje.ebean.annotation.CreatedTimestamp;
import com.avaje.ebean.annotation.DocStore;
@@ -18,7 +18,7 @@ import com.avaje.ebean.annotation.DocStore;
* Product entity bean.
*/
@DocStore
@CacheStrategy
@Cache
@CacheQueryTuning(maxSecsToLive = 15)
@Entity
@Table(name = "o_product")
@@ -9,9 +9,9 @@ import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
@CacheStrategy(useBeanCache=true)
@Cache
@Entity
public class Section extends BasicDomain {
@@ -3,9 +3,9 @@ package com.avaje.tests.model.basic;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
@CacheStrategy(useBeanCache=true)
@Cache
@Entity
public class SubSection extends BasicDomain {
@@ -1,47 +1,49 @@
package com.avaje.tests.model.basic;
import java.util.List;
import java.util.UUID;
import com.avaje.ebean.annotation.Cache;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import java.util.List;
import java.util.UUID;
@Cache
@Entity
public class UUOne {
@Id
UUID id;
String name;
@Id
UUID id;
String name;
@OneToMany(cascade=CascadeType.ALL, mappedBy="master")
List<UUTwo> comments;
public UUID getId() {
return id;
}
@OneToMany(cascade = CascadeType.ALL, mappedBy = "master")
List<UUTwo> comments;
public void setId(UUID id) {
this.id = id;
}
public UUID getId() {
return id;
}
public String getName() {
return name;
}
public void setId(UUID id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public List<UUTwo> getComments() {
return comments;
}
public void setName(String name) {
this.name = name;
}
public List<UUTwo> getComments() {
return comments;
}
public void setComments(List<UUTwo> comments) {
this.comments = comments;
}
public void setComments(List<UUTwo> comments) {
this.comments = comments;
}
}
@@ -1,12 +1,12 @@
package com.avaje.tests.model.basic.cache;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
@CacheStrategy
@Cache
@Entity
@Inheritance
@DiscriminatorValue("O")
@@ -1,13 +1,13 @@
package com.avaje.tests.model.basic.cache;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
import com.avaje.tests.model.basic.BasicDomain;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
@CacheStrategy
@Cache
@Entity
@Inheritance
@DiscriminatorColumn(length = 3)
@@ -1,12 +1,12 @@
package com.avaje.tests.model.basic.cache;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
@CacheStrategy
@Cache
@Entity
@Inheritance
@DiscriminatorValue("T")
@@ -1,5 +1,7 @@
package com.avaje.tests.model.embedded;
import com.avaje.ebean.annotation.Cache;
import java.util.Date;
import javax.persistence.AttributeOverride;
@@ -11,6 +13,7 @@ import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Version;
@Cache
@Entity
public class EInvoice {
@@ -1,6 +1,6 @@
package com.avaje.tests.model.m2m;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.Cache;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -14,7 +14,7 @@ import java.util.UUID;
* The Class Permission.
*/
@Entity
@CacheStrategy(readOnly = true)
@Cache(readOnly = true)
@Table(name = "mt_permission")
public class Permission {