Hi,
When I try to use an arithmetic expression in a query I get an exception.
Do I have to use a SQL query ?
Hibernate version:2.1.6
Mapping documents: <query name="findSmsNumberToSendInQuotas"> <![CDATA[ select sum(sq.maxToSend) - sum(sq.sent) from SmsQuota as sq where sq.account.id = ? and current_date >= sq.startDate and current_date <= sq.endDate and sq.maxToSend > 0 and sq.sent < sq.maxToSend order by sq.priority desc ]]> </query>
Full stack trace of any exception that occurs: net.sf.hibernate.QueryException: , expected in SELECT [ select sum(sq.maxToSend) - sum(sq.sent) from com.tunisiana.mytunisiana.model.SmsQuota as sq where sq.account.id = ? and current_date >= sq.startDate and current_date <= sq.endDate and sq.maxToSend > 0 and sq.sent < sq.maxToSend order by sq.priority desc ] at net.sf.hibernate.hql.SelectParser.token(SelectParser.java:169) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87) at net.sf.hibernate.hql.ClauseParser.end(ClauseParser.java:114) at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:143) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138) at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:294) at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1562) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1533) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
Name and version of the database you are using:Oracle 9i
|