Add cascading delete for connected entities
This commit is contained in:
parent
0d4eb694c9
commit
4e560b9d36
@ -3,6 +3,8 @@ package de.hft.geotime.entities;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
@ -19,6 +21,7 @@ public class TimeRecord {
|
||||
private long id;
|
||||
|
||||
@ManyToOne
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private TimetrackAccount account;
|
||||
|
||||
@Column(columnDefinition = "TIMESTAMP")
|
||||
|
@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@ -21,6 +23,7 @@ public class TimetrackAccount {
|
||||
private String description;
|
||||
|
||||
@ManyToOne
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private TimetrackUser user;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user