因为这两个答案都没有为您提供完整的解决方案:
@OneToMany@JoinColumn(name="task_id")@OrderBy("created")List<TaskNote> notes;public List<TaskNote> getNotes() {return notes;}public void setNotes(List<TaskNote> notes) {this.notes = notes;}Set是无序的,请
List改用,并且也需要
@OrderBy注释。

因为这两个答案都没有为您提供完整的解决方案:
@OneToMany@JoinColumn(name="task_id")@OrderBy("created")List<TaskNote> notes;public List<TaskNote> getNotes() {return notes;}public void setNotes(List<TaskNote> notes) {this.notes = notes;}Set是无序的,请
List改用,并且也需要
@OrderBy注释。