java - An exception occurred while creating a query in EntityManager -
this query.
list exp = entitymanager.getentitymanager() .createquery("select sum(u.expenseamount), u.wdexpensegroup.expensegroupname wdexpense u month(cast(u.expensedate date)) = month(now()) , year(cast(u.expensedate date)) = year(now()) group u.wdexpensegroup.expensegroupid") .getresultlist();
i'm getting below error.
java.lang.illegalargumentexception: exception occurred while creating query in entitymanager: exception description: syntax error parsing query [select sum(u.expenseamount), u.wdexpensegroup.expensegroupname wdexpense u month(cast(u.expensedate date)) = month(now()) , year(cast(u.expensedate date)) = year(now()) group u.wdexpensegroup.expensegroupid], line 1, column 91: unexpected token [(]. internal exception: noviablealtexception(83!=[661:1: simpleconditionalexpressionremainder[object left] returns [object node] : (n= comparisonexpression[left] | (n1= not )? n= conditionwithnotexpression[(n1!=null), left] | (n2= not )? n= isexpression[(n2!=null), left] );])
how can solve ?
month, year, etc not valid jpql. see http://www.datanucleus.org/products/accessplatform_4_0/jpa/jpql.html#jpql_bnf_notation
Comments
Post a Comment