Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1514

ClassCastException when EJQLQuery parameters is null.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.1
    • Fix Version/s: 3.1M3, 3.0.3
    • Component/s: Core Library
    • Labels:
      None
    • Environment:
      Tomcat 6.0.26

      Description

      When a parameter in EJBQLQuery is set to null, an error occurs which results in ClassCastException. When parameter is not null query is executed as expected.
      It is duplicable with following/similar code:

      EJBQLQuery eq = new EJBQLQuery("SELECT COUNT(u) FROM User u WHERE u.username like :usernam AND u.userInfo.name like :userName");
      eq.setParameter("userName", null);
      eq.setParameter("usernam", "msabo");
      return (Long) DataObjectUtils.objectForQuery(getObjectContext(), eq);

      Full stack trace is in attachment.

        Attachments

        1. cayST.txt
          6 kB
          Marek Šabo
        2. ejbql-null-parameters.patch
          2 kB
          Dzmitry Kazimirchyk
        3. test.patch
          1 kB
          Dzmitry Kazimirchyk

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              zeratul Marek Šabo
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: