hello,
i was hoping someone could tell me where i've gone wrong on this query, i've tried executing the sql generated and that works fine.
thanks, cam
HQL
Code:
select sum(i.quantity * i.unitPrice) from OrderItem as i where i.order.account = ?
SQL
Code:
select sum(orderitem0_.quantity*orderitem0_.unitPrice) as x0_0_ from OrderItem orderitem0_, Orders order1_ where (order1_.account=? and orderitem0_.orderId=order1_.id)
Error
Code:
java.sql.SQLException: Column 'x1_0_' not found.
at com.mysql.jdbc.ResultSet.findColumn(ResultSet.java:2260)
at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:1282)
at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:220)
at net.sf.hibernate.type.IntegerType.get(IntegerType.java:18)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.hql.QueryTranslator.getResultColumnOrRow(QueryTranslator.java:981)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:221)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:132)
at net.sf.hibernate.loader.Loader.doList(Loader.java:949)
at net.sf.hibernate.loader.Loader.list(Loader.java:940)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:833)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1475)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1454)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1450)