Invalid Comparable class:java.lang.Boolean

From: Bryan Lewis (brya..aine.rr.com)
Date: Tue Oct 12 2004 - 22:37:24 EDT

  • Next message: Andrus Adamchik: "Re: SQLTemplate generates Date instead of Timestamp?"

    While converting an old WebObjects app, I've written this code:

         List phones = getPhoneNumbers();
         Ordering ordering = new Ordering("isPrimary", false);
         ordering.orderList(phones);

    That might seem like a silly ordering; it's a shortcut our old apps
    often used to find an object in a list with a certain boolean value...
    sort on the value and take the first one. Anyway, I get this exception:

    Invalid Comparable class:java.lang.Boolean

    with the stack trace pointing to:

    org.objectstyle.cayenne.util.ConversionUtil.toComparable(ConversionUtil.java:138)

    Now, this isn't a big deal, since I can accomplish the objective with a
    match expression. (And I've had no trouble ordering on strings,
    integers and dates.) I just wanted to check that I'm interpreting the
    error correctly, that Boolean attributes cannot be used for an Ordering.

    Thanks.



    This archive was generated by hypermail 2.0.0 : Tue Oct 12 2004 - 22:37:38 EDT