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

ClassCastException when EJQLQuery parameters is null.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.1
    • 3.1M3, 3.0.3
    • Core Library
    • None
    • 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. test.patch
          1 kB
          Dzmitry Kazimirchyk
        2. ejbql-null-parameters.patch
          2 kB
          Dzmitry Kazimirchyk
        3. cayST.txt
          6 kB
          Marek Šabo

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: