Query with having - Variable a1 is unbound and cannot be determined #278

Closed
renataogarcia opened this Issue Nov 10, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@renataogarcia
Contributor

renataogarcia commented Nov 10, 2012

Given the class:

@PersistenceCapable
case class Employee(var department:String, var salary: Int)

and the query using Scala:
query from employee groupBy department having salary.avg > 100 select (department, salary.avg)

It generates the query:
SELECT this.department, avg(this.salary) INTO scala.Tuple2 FROM Employee GROUP BY this.department HAVING avg(this.salary) > a1

and fails to execute with the following error:
Variable a1 is unbound and cannot be determined
org.datanucleus.exceptions.NucleusUserException: Variable a1 is unbound and cannot be determined
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processUnboundExpression(QueryToSQLMapper.java:3342)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processGtExpression(QueryToSQLMapper.java:1793)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileRelationalExpression(AbstractExpressionEvaluator.java:97)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileOrAndExpression(AbstractExpressionEvaluator.java:65)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.evaluate(AbstractExpressionEvaluator.java:46)
at org.datanucleus.query.expression.Expression.evaluate(Expression.java:337)
at org.datanucleus.query.expression.DyadicExpression.evaluate(DyadicExpression.java:73)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compileHaving(QueryToSQLMapper.java:820)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compile(QueryToSQLMapper.java:402)
at org.datanucleus.store.rdbms.query.JDOQLQuery.compileQueryFull(JDOQLQuery.java:883)
at org.datanucleus.store.rdbms.query.JDOQLQuery.compileInternal(JDOQLQuery.java:343)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1747)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:1666)
at org.datanucleus.store.query.Query.execute(Query.java:1639)
at org.datanucleus.api.jdo.JDOQuery.execute(JDOQuery.java:221)
at com.mysema.query.jdo.AbstractJDOQLQuery.execute(AbstractJDOQLQuery.java:187)
at com.mysema.query.jdo.AbstractJDOQLQuery.list(AbstractJDOQLQuery.java:232)
at com.mysema.query.scala.RichProjectable.select(Helpers.scala:66)

I'm using Querydsl 2.8.2/ DN-JDO 3.1.2

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Nov 19, 2012

Member

Released in 2.9.0

Member

timowest commented Nov 19, 2012

Released in 2.9.0

@timowest timowest closed this Nov 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment