#652 - ENH: L2 cache - add @CacheQueryTuning annotation

This commit is contained in:
Robin Bygrave
2016-04-18 09:46:42 +12:00
parent 1b8b05790e
commit 2de78cd20f
10 changed files with 303 additions and 89 deletions
@@ -1,66 +1,64 @@
package com.avaje.tests.model.basic;
import java.util.ArrayList;
import java.util.List;
import com.avaje.ebean.annotation.CacheStrategy;
import com.avaje.ebean.annotation.CacheTuning;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import com.avaje.ebean.annotation.CacheStrategy;
import java.util.ArrayList;
import java.util.List;
@CacheStrategy
@CacheTuning(maxSecsToLive = 45)
@Entity
public class Article extends BasicDomain {
private static final long serialVersionUID = 1L;
String name;
String name;
String author;
@OneToMany(cascade=CascadeType.ALL)
List<Section> sections;
String author;
public Article() {
}
public Article(String name, String author) {
this.name = name;
this.author = author;
}
public String getName() {
return name;
}
@OneToMany(cascade = CascadeType.ALL)
List<Section> sections;
public void setName(String name) {
this.name = name;
}
public Article() {
}
public String getAuthor() {
return author;
}
public Article(String name, String author) {
this.name = name;
this.author = author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getName() {
return name;
}
public List<Section> getSections() {
return sections;
}
public void setName(String name) {
this.name = name;
}
public void setSections(List<Section> sections) {
this.sections = sections;
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public List<Section> getSections() {
return sections;
}
public void setSections(List<Section> sections) {
this.sections = sections;
}
public void addSection(Section s) {
if (sections == null) {
sections = new ArrayList<Section>();
}
public void addSection(Section s){
if (sections == null){
sections = new ArrayList<Section>();
}
sections.add(s);
}
sections.add(s);
}
}
@@ -9,6 +9,7 @@ import javax.persistence.Table;
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.CreatedTimestamp;
import com.avaje.ebean.annotation.DocStore;
@@ -18,6 +19,7 @@ import com.avaje.ebean.annotation.DocStore;
*/
@DocStore
@CacheStrategy
@CacheQueryTuning(maxSecsToLive = 15)
@Entity
@Table(name = "o_product")
public class Product implements Serializable {