Cayenne
  1. Cayenne
  2. CAY-1514

ClassCastException when EJQLQuery parameters is null.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.1
    • Fix Version/s: 3.0.3, 3.1M3
    • 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.

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

        Activity

        No work has yet been logged on this issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development