fix: updating foreign keys when adding new entity to the db

This commit is contained in:
Théo Le Lez
2025-03-15 15:23:18 +01:00
parent d5c89bf8f4
commit c94d3654ce
10 changed files with 206 additions and 18 deletions

@ -11,7 +11,7 @@ import java.util.List;
public class SectionCell {
@ManyToMany(mappedBy = "listSectionCell")
private final List<Appointment> appointment = new ArrayList<>();
private final List<Appointment> listAppointment = new ArrayList<>();
@OneToMany(mappedBy = "sectionCellAnnotation", fetch = FetchType.LAZY, orphanRemoval = true)
private final List<Annotation> listAnnotation = new ArrayList<>();
@ -39,11 +39,13 @@ public class SectionCell {
Long idSectionCell,
Long sectionId,
String contentSectionCell,
LocalDateTime modificationDate) {
LocalDateTime modificationDate,
Project projectSectionCell) {
this.idSectionCell = idSectionCell;
this.sectionId = sectionId;
this.contentSectionCell = contentSectionCell;
this.modificationDate = modificationDate;
this.projectSectionCell = projectSectionCell;
}
public Long getIdSectionCell() {
@ -83,6 +85,26 @@ public class SectionCell {
}
public List<Appointment> getAppointmentSectionCell() {
return appointment;
return listAppointment;
}
public void updateAppointmentSectionCell(Appointment appointment) {
listAppointment.add(appointment);
}
public List<Annotation> getListAnnotation() {
return listAnnotation;
}
public void updateListAnnotation(Annotation annotation) {
listAnnotation.add(annotation);
}
public void setSectionId(long sectionId) {
this.sectionId = sectionId;
}
public void setProjectSectionCell(Project projectSectionCell) {
this.projectSectionCell = projectSectionCell;
}
}