glassfish
  1. glassfish
  2. GLASSFISH-248

Incorrect data type is used for CURRENT_DATE

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 9.0pe
    • Fix Version/s: 9.0pe
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: Linux
      Platform: PC

    • Issuezilla Id:
      248

      Description

      [Glassfish build 32e]
      I have a Entity class with defined TemporalType.DATE, then I would like to use
      this property in EJBQL with CURRENT_DATE like this:

      em.createQuery("SELECT a FROM Plan a WHERE a.creationTime <= :time AND
      a.deadLineDate = CURRENT_DATE")

      I get exception Caused by: org.apache.derby.client.am.SqlException: Comparisons
      between 'DATE' and 'TIMESTAMP' are not supported.

      Sources and stack trace are attached.

      Stack trace:
      Internal Exception: org.apache.derby.client.am.SqlException: Comparisons between
      'DATE' and 'TIMESTAMP' are not supported.Error Code: -1
      Call:SELECT PLAN_ID, CREATIONTIME, DEADLINEDATE FROM PLAN WHERE ((CREATIONTIME
      <=

      {t '20:25:21'}

      ) AND (DEADLINEDATE = CURRENT TIMESTAMP))
      Query:ReportQuery(testdate.Plan)
      at
      oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:303)
      at
      oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:551)
      at
      oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:437)
      at
      oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.executeCall(UnitOfWorkImpl.java:1368)
      at
      oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:213)
      at
      oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:199)
      at
      oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:270)
      at
      oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:574)
      at
      oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:1988)
      at
      oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllReportQueryRows(ExpressionQueryMechanism.java:1954)
      at
      oracle.toplink.essentials.queryframework.ReportQuery.executeDatabaseQuery(ReportQuery.java:699)
      at
      oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
      at
      oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:796)
      at
      oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:850)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.internalExecuteQuery(RepeatableWriteUnitOfWork.java:130)
      at
      oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:925)
      at
      oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:897)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:319)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:402)
      at testdate.NewMain.main(NewMain.java:50)

      1. NewMain.java
        2 kB
        blaha
      2. Plan.java
        2 kB
        blaha

        Activity

        Hide
        blaha added a comment -

        Created an attachment (id=75)
        entity class

        Show
        blaha added a comment - Created an attachment (id=75) entity class
        Hide
        blaha added a comment -

        Created an attachment (id=76)
        file with a query

        Show
        blaha added a comment - Created an attachment (id=76) file with a query
        Hide
        Mitesh Meswani added a comment -

        reassigning

        Show
        Mitesh Meswani added a comment - reassigning
        Hide
        Mitesh Meswani added a comment -

        EJBQL CURRENT_DATE is mapped to derby CURRENT TIMESTAMP. To investigate if there
        is any alternative available.

        Show
        Mitesh Meswani added a comment - EJBQL CURRENT_DATE is mapped to derby CURRENT TIMESTAMP. To investigate if there is any alternative available.
        Hide
        Mitesh Meswani added a comment -

        sent the fix for review

        Show
        Mitesh Meswani added a comment - sent the fix for review
        Hide
        Mitesh Meswani added a comment -

        Checked in the fix today

        Show
        Mitesh Meswani added a comment - Checked in the fix today

          People

          • Assignee:
            Mitesh Meswani
            Reporter:
            blaha
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: