How to do a distinct count in JPA critera API?

后端 未结 4 1487
盖世英雄少女心
盖世英雄少女心 2021-02-13 10:14

I would like to do this but with the criteria API instead:

select count(distinct e) from Event e, IN(e.userAccessPermissions) p where p.principal = :principal an         


        
4条回答
  •  孤街浪徒
    2021-02-13 10:49

    Use c.distinct(true) on your Query.

    See http://relation.to/Bloggers/ATypesafeCriteriaQueryAPIForJPA for more samples.

提交回复
热议问题