fix: removed contradictive @NotNull preventing to add data to database.

This commit is contained in:
Pierre Tellier 2025-03-09 21:04:52 +01:00
parent dded62c25a
commit 215d80ad70
8 changed files with 5 additions and 22 deletions

View File

@ -13,14 +13,14 @@ import java.util.List;
public class Administrator extends User {
@OneToMany(mappedBy = "projectAdministrator", fetch = FetchType.LAZY, orphanRemoval = true)
private List<Project> listProject = new ArrayList<>();
private final List<Project> listProject = new ArrayList<>();
/*@OneToMany(mappedBy = "administratorSectionCell", fetch = FetchType.LAZY, orphanRemoval = true)
private List<SectionCell> listSectionCell = new ArrayList<>();*/
// should now be useless
@OneToMany(mappedBy = "administratorAnnotation", fetch = FetchType.LAZY, orphanRemoval = true)
private List<Annotation> listAnnotation = new ArrayList<>();
private final List<Annotation> listAnnotation = new ArrayList<>();
/*@OneToMany(mappedBy = "administratorAppointment", fetch = FetchType.LAZY, orphanRemoval = true)
private final List<Appointment> listAppointment = new ArrayList<>();*/
@ -32,12 +32,11 @@ public class Administrator extends User {
public Administrator() {}
public Administrator(
Long idUser,
String userSurname,
String username,
String mainMail,
String secondaryMail,
String phoneNumber) {
super(idUser, userSurname, username, mainMail, secondaryMail, phoneNumber);
super(null, userSurname, username, mainMail, secondaryMail, phoneNumber);
}
}

View File

@ -1,14 +1,12 @@
package enseirb.myinpulse.model;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
@Entity
@Table(name = "annotation")
public class Annotation {
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idAnnotation;

View File

@ -1,7 +1,6 @@
package enseirb.myinpulse.model;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalTime;
@ -17,9 +16,6 @@ public class Appointment {
new ArrayList<>(); */
// should now be useless
@OneToOne(mappedBy = "appointmentReport", fetch = FetchType.LAZY, orphanRemoval = true)
private Report report;
@ManyToMany(
fetch = FetchType.LAZY,
cascade = {CascadeType.ALL})
@ -28,9 +24,9 @@ public class Appointment {
joinColumns = @JoinColumn(name = "idAppointment"),
inverseJoinColumns = @JoinColumn(name = "idSectionCell"))
List<SectionCell> listSectionCell = new ArrayList<>();
@OneToOne(mappedBy = "appointmentReport", fetch = FetchType.LAZY, orphanRemoval = true)
private Report report;
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idAppointment;

View File

@ -1,14 +1,12 @@
package enseirb.myinpulse.model;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
@Entity
@Table(name = "make_appointment")
public class MakeAppointment {
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idMakeAppointment;

View File

@ -1,7 +1,6 @@
package enseirb.myinpulse.model;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.ArrayList;
@ -18,7 +17,6 @@ public class Project {
private final List<SectionCell> listSectionCell = new ArrayList<>();
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idProject;

View File

@ -4,14 +4,12 @@ import jakarta.persistence.*;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
@Entity
@Table(name = "report")
public class Report {
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idReport;

View File

@ -1,7 +1,6 @@
package enseirb.myinpulse.model;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.ArrayList;
@ -18,7 +17,6 @@ public class SectionCell {
private final List<Annotation> listAnnotation = new ArrayList<>();
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idSectionCell;

View File

@ -1,7 +1,6 @@
package enseirb.myinpulse.model;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
@Entity
@Table(name = "user_inpulse")
@ -9,7 +8,6 @@ import jakarta.validation.constraints.NotNull;
public class User {
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idUser;