glassfish
  1. glassfish
  2. GLASSFISH-3716

Toplink query parsing error with negative integers and in clause

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.1pe
    • Fix Version/s: not determined
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: Linux
      Platform: Linux

    • Issuezilla Id:
      3,716
    • Status Whiteboard:
      Hide

      as91ur1-na as911-na

      Show
      as91ur1-na as911-na

      Description

      Toplink throws an EJBQLException on the negative sign when a query with an "in"
      clause contains a negative integer constant. I created a simple test case to
      verify the problem. The first method below works and the second one fails. The
      output from server.log is included below the test methods.

      public void testEntity() {
      List notifications = em.createQuery("select n from Notification n where
      n.status in (1, 0)").getResultList();
      System.out.println("Found " + notifications.size() + " notifications");
      }

      public void testEntityBroken() {
      List notifications = em.createQuery("select n from Notification n where
      n.status in (1, 0, -1)").getResultList();
      System.out.println("Found " + notifications.size() + " notifications");
      }

      [#|2007-10-01T15:12:03.457-0400|FINE|sun-appserver9.1|oracle.toplink.essentials.session.file:/usr/local/glassfish/nodeagents/labejb04/instance4/applications/j2ee-apps/GlassfishTest/GlassfishTest-ejb_jar/-testPU.sql|_ThreadID=27;_ThreadName=p:
      thread-pool-1; w:
      5;ClassName=null;MethodName=null;_RequestID=37ff48a4-04f7-4806-a99d-9b11b8ef927c;|SELECT
      notification_sid, status_cd FROM notification WHERE status_cd IN (?, ?)
      bind => [1, 0]|#]

      [#|2007-10-01T15:12:03.514-0400|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=27;_ThreadName=p:
      thread-pool-1; w: 5;|
      Found 71 notifications|#]

      [#|2007-10-01T15:12:16.679-0400|INFO|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=27;_ThreadName=p:
      thread-pool-1; w: 5;TestStatelessBean;|EJB5018: An exception was thrown during
      an ejb invocation on [TestStatelessBean]|#]

      [#|2007-10-01T15:12:16.679-0400|INFO|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=27;_ThreadName=p:
      thread-pool-1; w: 5;|
      javax.ejb.EJBException
      at
      com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3869)
      at
      com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3769)
      at
      com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3571)
      at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1354)
      at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316)
      at
      com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:210)
      at
      com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:77)
      at $Proxy91.testEntityBroken(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
      com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
      at
      com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
      at
      com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
      at
      com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
      at
      com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
      Caused by: java.lang.IllegalArgumentException: An exception occured while
      creating a query in EntityManager
      at
      oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:209)
      at
      com.sun.enterprise.util.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:349)
      at
      glassfishtest.TestStatelessBean.testEntityBroken(TestStatelessBean.java:48)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
      com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
      at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
      at
      com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
      at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
      at
      com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:203)
      ... 17 more
      Caused by: Exception [TOPLINK-8025] (Oracle TopLink Essentials - 2.0 (Build
      b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EJBQLException
      Exception Description: Syntax error parsing the query [select n from
      Notification n where n.status in (1, 0, -1)], line 1, column 55: unexpected
      token [-].
      Internal Exception: line 1:55: unexpected token: -
      at
      oracle.toplink.essentials.exceptions.EJBQLException.unexpectedToken(EJBQLException.java:389)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.handleANTLRException(EJBQLParser.java:350)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.addError(EJBQLParser.java:278)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.reportError(EJBQLParser.java:378)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.inItem(EJBQLParser.java:2915)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.inExpression(EJBQLParser.java:2728)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.conditionWithNotExpression(EJBQLParser.java:2536)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.simpleConditionalExpressionRemainder(EJBQLParser.java:2376)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.simpleConditionalExpression(EJBQLParser.java:2283)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.conditionalPrimary(EJBQLParser.java:2218)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.conditionalFactor(EJBQLParser.java:2155)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.conditionalTerm(EJBQLParser.java:2030)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.conditionalExpression(EJBQLParser.java:1989)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.whereClause(EJBQLParser.java:507)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.selectStatement(EJBQLParser.java:184)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.document(EJBQLParser.java:135)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.parse(EJBQLParser.java:166)
      at
      oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.buildParseTree(EJBQLParser.java:127)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:215)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:189)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:153)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:114)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:99)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.<init>(EJBQueryImpl.java:86)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:204)
      ... 28 more
      Caused by: line 1:55: unexpected token: -
      at
      oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.inItem(EJBQLParser.java:2909)
      ... 48 more

      #]

        Activity

        Hide
        gfbugbridge added a comment -

        <BT6611856>

        Show
        gfbugbridge added a comment - <BT6611856>
        Hide
        sarnoth added a comment -
            • Issue 3716 has been confirmed by votes. ***
        Show
        sarnoth added a comment - Issue 3716 has been confirmed by votes. ***
        Hide
        tware added a comment -

        Updating target milestone

        Show
        tware added a comment - Updating target milestone
        Hide
        Mitesh Meswani added a comment -

        Will not be fixed for V2.1

        Show
        Mitesh Meswani added a comment - Will not be fixed for V2.1
        Hide
        sanandal added a comment -

        "Reclassifying as P4 because this issue is not deemed "must fix" for this v2.1
        release whose primary release driver is SailFin.
        This issue will be scrubbed after this release and will be given the right
        priority for the next release."

        Show
        sanandal added a comment - "Reclassifying as P4 because this issue is not deemed "must fix" for this v2.1 release whose primary release driver is SailFin. This issue will be scrubbed after this release and will be given the right priority for the next release."
        Hide
        Tom Mueller added a comment -

        Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

        Show
        Tom Mueller added a comment - Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

          People

          • Assignee:
            tware
            Reporter:
            sarnoth
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: