mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-23 16:47:18 +00:00
#894 - ENH: Add support for @OneToMany orphanRemoval = true (which is the same as @PrivateOwned)
This commit is contained in:
@@ -55,6 +55,10 @@ class AnnotationAssocManys extends AnnotationParser {
|
||||
OneToMany oneToMany = get(prop, OneToMany.class);
|
||||
if (oneToMany != null) {
|
||||
readToOne(oneToMany, prop);
|
||||
if (oneToMany.orphanRemoval()) {
|
||||
prop.setModifyListenMode(ModifyListenMode.REMOVALS);
|
||||
prop.getCascadeInfo().setDelete(true);
|
||||
}
|
||||
PrivateOwned privateOwned = get(prop, PrivateOwned.class);
|
||||
if (privateOwned != null) {
|
||||
prop.setModifyListenMode(ModifyListenMode.REMOVALS);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import com.avaje.ebean.annotation.PrivateOwned;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@@ -29,8 +27,7 @@ public class TSMaster {
|
||||
|
||||
boolean active;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "master")
|
||||
@PrivateOwned
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "master", orphanRemoval = true)
|
||||
List<TSDetail> details;
|
||||
|
||||
public Integer getId() {
|
||||
|
||||
Reference in New Issue
Block a user