You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Dzmitry Kazimirchyk (JIRA)" <ji...@apache.org> on 2011/06/07 15:21:58 UTC

[jira] [Updated] (CAY-1514) ClassCastException when EJQLQuery parameters is null.

     [ https://issues.apache.org/jira/browse/CAY-1514?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dzmitry Kazimirchyk updated CAY-1514:
-------------------------------------

    Attachment: ejbql-null-parameters.patch
                test.patch

LIKE expression's parameters are always parsed into PatternValue objects which I think is the reason of the issue.
I suppose we can change grammar for parser generator to fix this.
I've added unit test and patch for trunk, for 3.0 branch it works the same way.

> ClassCastException when EJQLQuery parameters is null.
> -----------------------------------------------------
>
>                 Key: CAY-1514
>                 URL: https://issues.apache.org/jira/browse/CAY-1514
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.0.1
>         Environment: Tomcat 6.0.26
>            Reporter: Marek Ĺ abo
>         Attachments: cayST.txt, ejbql-null-parameters.patch, test.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira