Hibernate @OrderBy with referenced class

前端 未结 4 883
广开言路
广开言路 2021-01-12 23:34

I have a class say: \"ClassA\" which has a collection of \"ClassB\"

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = \"COLUMN         


        
4条回答
  •  生来不讨喜
    2021-01-13 00:04

    This is possible if you use JPA. See this article.

    Then you just add @OrderBy("name") to the collection property

提交回复
热议问题