我使用Spring Boot 2.1,JPA和Hibernate。
在我的示例实体中
@EmbeddedId
private SampleId id;
@MapsId("samplingId")
@ManyToOne(optional = false)
private Samplings sampling;
我的复合对象
@Embeddable
public class SampleId implements Serializable{
private Integer samplingId;
private String sampleLetter;
//get //set
}
@Query(
value = "select s from Samples s "
+ "Join fetch s.sampling sp "
+ "where sp.id >= :sampleId.samplingId and s.id !=:sampleId "
+ "order by s.id.samplingId,s.id.sampleLetter"
)
public List<Samples> findNextAbsorptionTest(@Param("sampleId") SampleId sampleId);
好像冬眠的人不喜欢这部分
sp.id> =:sampleId.samplingId
如果我将其删除,该工作