Skip to content

Commit

Permalink
updated entities removed recursive nature
Browse files Browse the repository at this point in the history
  • Loading branch information
Junotas committed Jul 17, 2024
1 parent d924802 commit 0ce31f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.example.workreportbackend.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;
import jakarta.persistence.*;
import java.util.*;

import java.util.HashSet;
import java.util.Set;

@Entity
@Table(name = "employees")
Expand All @@ -21,8 +24,9 @@ public class Employee {
private Boolean isAdmin;

@OneToMany(mappedBy = "employee", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
@JsonBackReference
private Set<TimeReport> timeReports = new HashSet<>();

public Long getId() {
return id;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.example.workreportbackend.entity;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import jakarta.persistence.*;
import java.time.LocalDateTime;

Expand All @@ -12,6 +13,7 @@ public class TimeReport {

@ManyToOne
@JoinColumn(name = "employee_id")
@JsonManagedReference
private Employee employee;

private LocalDateTime startTime;
Expand Down

0 comments on commit 0ce31f4

Please sign in to comment.