issue-113: Fix all Delete Operations #114
@ -34,7 +34,7 @@ public class Task {
|
||||
@OneToOne(mappedBy = "task", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private TaskSerieItem taskSerieItem;
|
||||
|
||||
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
@OneToMany(mappedBy = "parent", cascade = CascadeType.REMOVE, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
private Set<Task> subtasks;
|
||||
|
||||
@ManyToOne
|
||||
|
@ -15,9 +15,6 @@ public class TaskSerie {
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "taskSerie", orphanRemoval = true)
|
||||
List<TaskSerieItem> tasks = new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
|
||||
public long getTaskSerieID() {
|
||||
return taskSerieID;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class Taskgroup {
|
||||
@JoinColumn(name = "taskgroupuser", nullable = false)
|
||||
private User user;
|
||||
|
||||
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||
@OneToMany(mappedBy = "parent", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||
private Set<Taskgroup> children;
|
||||
|
||||
@ManyToOne
|
||||
@ -33,7 +33,7 @@ public class Taskgroup {
|
||||
private Taskgroup parent;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "taskgroup", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||
@OneToMany(mappedBy = "taskgroup", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||
private Set<Task> tasks;
|
||||
|
||||
public Taskgroup(String taskgroupName, User user) {
|
||||
|
@ -135,11 +135,7 @@ public class TaskSeriesService {
|
||||
task.setTaskSerieItem(null);
|
||||
taskSerieItemRepository.delete(item);
|
||||
if(taskSerie.getTasks().isEmpty()) {
|
||||
for(TaskSerieItem taskSerieItem : taskSerie.getTasks()) {
|
||||
taskSerieItem.setTaskSerie(null);
|
||||
}
|
||||
taskSerie.getTasks().clear();
|
||||
taskSeriesRepository.delete(taskSerie);
|
||||
taskSeriesRepository.deleteUnreferenced();
|
||||
} else if(task.getParent() == null){
|
||||
repearIndexing(taskSerie, item.getSeriesIndex());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user