JPA Query Group By with Count -


in application have classes , b. has list of bs, annotated 1 many annotation in a. size of list variable , can empty. want select have @ least 2 b in list , return , bs. both classes use composite ids, have use id in group clause far understand.

here query works, need modify:

select a, count (b) a join a.linksb b group a.id having count (b) > 1 

this returns count of linked bs if linked @ least 2 bs.

if want return bs well, jpa tells me have use b in group renders count (b)>1 useless. there way achieve goal?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -