我在用
@OrderBy
子句在我的bean上当我从持久层获取这个对象时,这很好,但是当我试图使用
persistedObject = saveAndFlush(MyCustomObject);
结果
persistedObject
未按照
@勤务员
条款
代码片段:
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@JoinColumn(name = "COLLECTION_ID")
@OrderBy("order ASC")
private Set<MySections> sections;
class MySections {
// Some Properties
@Column(name = "SEQ_NO")
private Integer order;
}
与存储库相关的代码
// this brings sections ordered by order property
collectionRepository.findById("123");
// Sections in persistedCollection are not ordered
persistedCollection = collectionRepository.saveAndFlush(collection);