0 Replies Latest reply on May 5, 2008 4:13 PM by kooudy

    EntityQuery with empty restriction

    kooudy

      I have exactly the same problem like in topic mentoined bellow:


      http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029206#4029206


      There is a list of objects which serves as restrictions for search condition.


      If this list isn't empty, it works well.


      But when the list is empty, this exception is thrown:


      restrictions.add("action.region in (#{actionFilter.regions})");
      



      Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [select action from cz.Action action where action.region in ()]
              at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
              at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
              at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
              at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:235)
              at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
              at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
              at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
              at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
              at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
              at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
              at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1113)
              at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
              at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
              ... 200 more
      
      



      It doesn't seem to me like a database error as it is mentoined in the link above.


      thanks for clarification