How to query a property of type Listin JPA

前端 未结 3 1955
渐次进展
渐次进展 2021-02-05 18:21

Lets say we have this JPA-annotated class, with a property of type List. This code is currently working fine.

@Entity
public class Family {
    ...
    @Collecti         


        
3条回答
  •  失恋的感觉
    2021-02-05 19:14

    MEMBER OF clause in JPQL:

    Query query = getEntityManager().createQuery("select f FROM Family f WHERE :element MEMBER OF f.element"); 
    query.setParameter("element", "yyy"); 
    return query.getResultList();
    

提交回复
热议问题