mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#118 - ENH: Add support for for Soft Deletes (Logical Deletion) ...
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.avaje.tests.model.softdelete;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.OneToMany;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
public class EBasicSoftDelete extends BaseSoftDelete {
|
||||
@@ -9,6 +12,13 @@ public class EBasicSoftDelete extends BaseSoftDelete {
|
||||
|
||||
String description;
|
||||
|
||||
@OneToMany(mappedBy = "owner", cascade = CascadeType.ALL)
|
||||
List<EBasicSDChild> children;
|
||||
|
||||
@OneToMany(mappedBy = "owner", cascade = CascadeType.ALL)
|
||||
List<EBasicNoSDChild> nosdChildren;
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -24,4 +34,28 @@ public class EBasicSoftDelete extends BaseSoftDelete {
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public List<EBasicSDChild> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<EBasicSDChild> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public void addChild(String childName, long amount) {
|
||||
getChildren().add(new EBasicSDChild(this, childName, amount));
|
||||
}
|
||||
|
||||
public List<EBasicNoSDChild> getNosdChildren() {
|
||||
return nosdChildren;
|
||||
}
|
||||
|
||||
public void setNosdChildren(List<EBasicNoSDChild> nosdChildren) {
|
||||
this.nosdChildren = nosdChildren;
|
||||
}
|
||||
|
||||
public void addNoSoftDeleteChild(String childName, long amount) {
|
||||
getNosdChildren().add(new EBasicNoSDChild(this, childName, amount));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user