glassfish
  1. glassfish
  2. GLASSFISH-207

EJB QL: Input parameter type is not determined from its' context

    Details

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

      Operating System: All
      Platform: Sun

    • Issuezilla Id:
      207

      Description

      If an invalid type is passed in as a parameter to an EJB QL query, the invalid
      type is not caught, instead the query returns no results. An
      IllegalArgumentException is expected to be thrown in this case.

      In this query:

      em.createQuery("select e from Employee e where e.firstName = ?1
      and e.lastName = ?2")
      .setParameter(1, "Sheila" )
      .setParameter(2, new Integer(9));

        Activity

        Hide
        mb124283 added a comment -

        Started checking parameter types.

        Show
        mb124283 added a comment - Started checking parameter types.
        Hide
        mb124283 added a comment -

        Added code allowing to check the type of an actual parameter value against
        the type determined from the usage context of the parameter. In the following
        WHERE clause the parameter name is compared with a string field, so the
        determined type is String: ... WHERE c.name = :name

        Now an IllegalArgumentException is thrown in case the type of the actual
        parameter values does not match the type determined from the parameter usage
        context.

        Show
        mb124283 added a comment - Added code allowing to check the type of an actual parameter value against the type determined from the usage context of the parameter. In the following WHERE clause the parameter name is compared with a string field, so the determined type is String: ... WHERE c.name = :name Now an IllegalArgumentException is thrown in case the type of the actual parameter values does not match the type determined from the parameter usage context.

          People

          • Assignee:
            mb124283
            Reporter:
            smcgowan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: