Fix intermittent sorting of criterion to actual order #18

Merged
tozh4728 merged 2 commits from 3495-grading-report-template-random-order into develop 2024-11-14 12:39:42 +01:00

View File

@ -10,6 +10,7 @@ import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.OrderBy;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
@ -22,7 +23,6 @@ import se.su.dsv.scipro.system.User;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@ -62,7 +62,8 @@ public class GradingReportTemplate extends DomainObject {
// JPA-mappings of other tables referencing to this table "grading_report_template"
// ----------------------------------------------------------------------------------
@OneToMany(mappedBy = "gradingReportTemplate", cascade = {CascadeType.ALL}, orphanRemoval = true)
private Collection<GradingCriterionTemplate> criteria = new HashSet<>();
@OrderBy("sortOrder ASC")
private List<GradingCriterionTemplate> criteria = new ArrayList<>();
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "grading_report_template_id", referencedColumnName = "id")