Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-7567

Getting an unexpected token : UNION when running a query

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Critical
    • None
    • 10.1.0.Final
    • JPA / Hibernate
    • None

    Description

      When running the below EJBQL wildfly 10.1.0 throws an exception. The same works fine in wildfly 9.2.0. I have manually edited the sql below to change the names of tables (so please ignore if there is an error in the sql). The data types of the columns selected are the same.

      SELECT a.pID FROM Arrangement a WHERE a.pID=30947 AND a.effectiveDate = '08/21/2001' UNION SELECT e.yID FROM Event e WHERE e.policyID=30947 AND e.proceedsDate = '08/20/2001'

      Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: UNION near line 1, column 86 [SELECT a.pID FROM Arrangement a WHERE a.pID=30947 AND a.effectiveDate = '08/21/2001' UNION SELECT e.yID FROM Event e WHERE e.policyID=30947 AND e.proceedsDate = '08/20/2001']
      at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74)
      at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:91)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:288)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:187)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:142)
      at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:115)
      at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:76)
      at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:150)
      at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:302)
      at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:240)
      at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1894)
      at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:291)
      ... 89 more

      Thanks,
      Prasanth

      Attachments

        Activity

          People

            smarlow1@redhat.com Scott Marlow
            ppasala@pangburngroup.net Prasanth Reddy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: