Я использую весеннюю загрузку 2.
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class Samplings {
@OneToMany(mappedBy = "sampling", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Samples> samples = new ArrayList<>();
...
}
@Entity
public class Samples {
@EmbeddedId
private SampleId id;
@MapsId("samplingId")
@ManyToOne(optional = false)
private Samplings sampling;
...
}
У меня большой запрос со странным результатом.
@Query("SELECT distinct(s) FROM Samplings s "
+ "Join fetch s.samples sa "
+ "Join fetch sa.testSamples ts "
+ "Join fetch s.product p "
+ "Join fetch p.productType pt "
+ "Left Join fetch s.color c "
+ "Left Join fetch s.dimension d "
+ "Left Join fetch s.machine m "
+ "inner Join fetch m.factory.emails "
+ "Left Join Fetch ts.compressionTest as ct "
+ "Left Join Fetch ts.flexionTest as ft "
+ "Left Join Fetch ts.csaDurabilityTest as csaDt "
+ "Left Join Fetch ts.bnqDurabilityTest as bnqDt "
+ "Left Join Fetch ts.csaScallingTest as csaSt "
+ "Left Join Fetch ts.bnqScallingTest as bnqSt "
+ "Left Join Fetch ts.absorptionTest as at "
+ "WHERE "
+ "( ct.nonCompliant=true and ct.emailSent=false) "
+ "or (ft.nonCompliant=true and ft.emailSent=false) "
+ "or (csaDt.nonCompliant=true and csaDt.emailSent=false) "
+ "or (bnqDt.nonCompliant=true and bnqDt.emailSent=false) "
+ "or (csaSt.nonCompliant=true and csaSt.emailSent=false) "
+ "or (bnqSt.nonCompliant=true and bnqSt.emailSent=false) "
+ "or (at.nonCompliant=true and at.emailSent=false) "
+ "ORDER BY m.factory.name, m.name asc")
У меня есть выборка из 3 образцов.Один из них не соответствует требованиям.
На самом деле запрос возвращает выборку с 3 выборками ... но 3 раза с одной и той же выборкой
вероятно ошибка в спящем режиме