spring data - JPA Custom @Query for counting !boolean -


i doing lot of arithmetic , joins in actual query, of working fine.

i have following (simplified version purpose of question) working custom query, counting number of instances 'issuccess == true':

@query("select new com.xyz.myentity(s.name, sum(s.issuccess)) sample s") public list<myentity> caclulateresults(); 

however count 's.issuccess = false' instead , curious easiest way achieve this? jpa documentation of not here. thank you!

i resolved doing.

sum(case s.issuccess when true 0 else 1 end)