delete cascade no more in switch
This commit is contained in:
parent
9ed2c66b54
commit
f368084464
1 changed files with 8 additions and 0 deletions
|
@ -5,6 +5,7 @@ import java.util.Set;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.PreRemove;
|
||||||
|
|
||||||
/** A switch input device */
|
/** A switch input device */
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -51,4 +52,11 @@ public class Switch extends InputDevice {
|
||||||
public Set<Switchable> getOutputs() {
|
public Set<Switchable> getOutputs() {
|
||||||
return switchables;
|
return switchables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreRemove
|
||||||
|
private void removeSwitchable() {
|
||||||
|
for (Switchable s : getOutputs()) {
|
||||||
|
s.setSwitchId(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue