Null handling - Exception or not [Was: (CAY-705) Ordering.sortList() does not work with null relationships]

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Dec 01 2006 - 06:46:16 EST

  • Next message: Aristedes Maniatis: "Re: Null handling - Exception or not [Was: (CAY-705) Ordering.sortList() does not work with null relationships]"

    I am taking this discussion to cayenne-dev from Jira. Essentially
    this is about whether Ordering (and Expression I guess) should throw
    on nulls in the middle of the property path (like OGNL does) or
    return NULL (like WebObjects does).

    I can think of one problem with returning nulls: we won't be
    comparing apples to apples ("painting.artist == null" is not the same
    as "painting.artist.name == null"). But of course it is a nice
    shortcut...

    Thoughts?

    Andrus

    Begin forwarded message:
    > From: "Marcin Skladaniec (JIRA)" <cayenne-de..ncubator.apache.org>
    > Date: December 1, 2006 2:19:04 PM GMT+03:00
    > To: andru..bjectstyle.org
    > Subject: [JIRA] Commented: (CAY-705) Ordering.sortList() does not
    > work with null relationships
    >
    > [ http://issues.apache.org/cayenne/browse/CAY-705?
    > page=comments#action_12175 ]
    >
    > Marcin Skladaniec commented on CAY-705:
    > ---------------------------------------
    >
    > Ok.
    > Cant cayenne have both ? that is can there be another flag in the
    > Ordering where to return null or throw exception ?
    > What is the benefit of throwing exception ? Sorting is meant to
    > happen on null values, and null in the path is just one more null.
    > See there is no simply way of handling that exception, for me it is
    > just annoyance. I would have to write a own sorting procedure and
    > abandon org.apache.cayenne.query.Ordering at all.
    >
    >
    >> Ordering.sortList() does not work with null relationships
    >> ---------------------------------------------------------
    >>
    >> Key: CAY-705
    >> URL: http://issues.apache.org/cayenne/browse/CAY-705
    >> Project: Cayenne
    >> Type: Bug
    >
    >> Components: Cayenne Core Library
    >> Versions: 3.0
    >> Reporter: Marcin Skladaniec
    >
    >>
    >> When list is sorted with customOrdering.sortList(list), and
    >> sorting is based on the field from the relationship the exception
    >> is raised.
    >
    > --
    > This message is automatically generated by JIRA.
    > -
    > If you think it was sent incorrectly contact one of the
    > administrators:
    > http://issues.apache.org/cayenne/secure/Administrators.jspa
    > -
    > For more information on JIRA, see:
    > http://www.atlassian.com/software/jira
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Dec 01 2006 - 06:46:46 EST