These are chat archives for hibernate/hibernate-orm

10th
Mar 2017
BİLGE
@bilgeebilgin
Mar 10 2017 12:52
blob
blob
hi i didnt understant what is wrong :/
ı think my HQL is correct
ryan2049
@ryan2049
Mar 10 2017 13:56
The last line of your hql should be a where
BİLGE
@bilgeebilgin
Mar 10 2017 14:17
@ryan2049 thank you ı confused ı corrected but ı am getting still exception that is org.hibernate.exception.SQLGrammarException: could not execute statement
so i will write another hql it seems so complex
Iwan Aucamp
@aucampia
Mar 10 2017 14:30
@bilgeebilgin can you paste directly instead of screenshot ? Also I'm not sure what you want SELECT COUNT(*)>0 to do but I don't think that will work
you should use having COUNT(*)>0
List<Object[]> personTotalCallDurations = entityManager.createQuery(
    "select p.name, sum( c.duration ) " +
    "from Call c " +
    "join c.phone ph " +
    "join ph.person p " +
    "group by p.name " +
    "having sum( c.duration ) > 1000", Object[].class )
.getResultList();
so just switch out sum for count
Iwan Aucamp
@aucampia
Mar 10 2017 14:37
@bilgeebilgin also - if possible share your schema - and I think you will need to do a join to do something like this: r1.dietProgram.id
BİLGE
@bilgeebilgin
Mar 10 2017 14:41
@aucampia now ı dont have time but i will share later thank you for your interest :)
:+1: