mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
65 lines
1.1 KiB
Java
65 lines
1.1 KiB
Java
package com.avaje.tests.model.basic;
|
|
|
|
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 java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
|
|
@CacheStrategy
|
|
@CacheTuning(maxSecsToLive = 45)
|
|
@Entity
|
|
public class Article extends BasicDomain {
|
|
|
|
String name;
|
|
|
|
String author;
|
|
|
|
@OneToMany(cascade = CascadeType.ALL)
|
|
List<Section> sections;
|
|
|
|
public Article() {
|
|
}
|
|
|
|
public Article(String name, String author) {
|
|
this.name = name;
|
|
this.author = author;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
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>();
|
|
}
|
|
sections.add(s);
|
|
}
|
|
|
|
}
|