annotation to filter results of a @OneToMany association

前端 未结 4 569
忘掉有多难
忘掉有多难 2020-11-27 07:10

I have parent/child relationship between two tables, and the corresponding mapping in my Java classes. The tables roughly look like that:

A (ref number, stuf         


        
4条回答
  •  旧巷少年郎
    2020-11-27 07:36

    Another solution is to use Hibernate's @Where: https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#pc-where

        @OneToMany
        @JoinColumn(name = "A_REF", referencedName = "REF")
        @Where(clause = "other = 123")
        private Set bs;
    

提交回复
热议问题