EJBQL doesn't support null parameters

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Tue Nov 10 2009 - 06:50:14 EST

  • Next message: Andrus Adamchik: "Re: tests against other databases"

    Hi,

    Currently EJBQL parameter cannot be set as null. Test is simple as follows:

    EJBQLQuery query = new EJBQLQuery("select p from Painting p WHERE
    p.toArtist=:x");
    query.setParameter("x", null);
    createDataContext().performQuery(query);

    Caused by: java.lang.ClassCastException:
    org.apache.cayenne.reflect.generic.DataObjectToOneProperty cannot be cast to
    org.apache.cayenne.reflect.AttributeProperty
        at
    org.apache.cayenne.access.jdbc.EJBQLConditionTranslator.processParameter(EJBQLConditionTranslator.java:708)
        at
    org.apache.cayenne.access.jdbc.EJBQLConditionTranslator.visitNamedInputParameter(EJBQLConditionTranslator.java:345)

    Is it OK or this is a bug? I mean, is this case covered by JPA spec, since
    it i think we still should keep it where possible



    This archive was generated by hypermail 2.0.0 : Tue Nov 10 2009 - 06:51:08 EST