我与@OrderColumn 有一个@ManyToMany 映射,如下所示:
class Tag {
@ManyToMany(fetch = FetchType.LAZY) @Getter
@JoinTable(
name = "tag_graph",
inverseJoinColumns = @JoinColumn(name = "parent_id"))
private Set<Tag> parents = new TreeSet<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "parents") @Getter @OrderColumn
private List<Tag> children = new ArrayList<>();
}
我的问题是我想编写一个使用生成的@JoinTable 的@OrderColumn 的JPQL 查询。就像是:
SELECT t FROM Tag t WHERE ... ORDER BY t.ORDER_COLUMN
有没有办法做到这一点?