You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Juergen Saar <ju...@jsaar.org> on 2006/12/04 12:52:35 UTC

Problem: Ordering.orderList and date-values

Hi,

if I use

public static void *orderList*(java.util.List objects,
                             java.util.List orderings)


from the Ordering-Class for sorting date-values it behaves like a toString()
from the date-values is sorted and so it's a order-by-day and not a
order-by-date.

Is there anything I can do?
--- Juergen ---

Re: Problem: Ordering.orderList and date-values

Posted by Tore Halset <ha...@pvv.ntnu.no>.
On Dec 4, 2006, at 15:25 , Juergen Saar wrote:

> BTW: I'm preparing for Cayenne 2.0.1, but converting all  
> packagenames from
> org.objectstyle to org.apache is not really fun ... any hints how  
> this can
> be done without too many keyboard-action?  (There are about 2000  
> Classes in
> our cayenne based projects)

This is how I did it: http://tinyurl.com/ymxgls

  - Tore.

Re: Re: Problem: Ordering.orderList and date-values

Posted by Michael Gentry <bl...@gmail.com>.
If you are using Unix, get rpl ...

http://www.laffeycomputer.com/rpl.html

You can use it to replace org.objectstyle.cayenne with
org.apache.cayenne recursively.

/dev/mrg


On 12/4/06, Juergen Saar <ju...@jsaar.org> wrote:
> I didn't expect toString() to be involved, but it was the easiest way to
> explain the sorting result.
>
> Currently I'm working with version 1.2.1 ... the problem is also in 1.1.4
>
> What I'm doing, is sorting a relation-list ... a kind of events of an order.
> Converting the Date with SimpleDateFormat("yyyyMMdd") to a comparable String
> should  be no problem, but I need a hint how I can clue this String to the
> List ...
>
> BTW: I'm preparing for Cayenne 2.0.1, but converting all packagenames from
> org.objectstyle to org.apache is not really fun ... any hints how this can
> be done without too many keyboard-action?  (There are about 2000 Classes in
> our cayenne based projects)
>
> 2006/12/4, Andrus Adamchik <an...@objectstyle.org>:
> >
> > java.lang.Comparable is used to order Date fields. "toString" is not
> > involved anywhere on Cayenne end. Is there a chance you are
> > converting the values to Strings yourself before doing the
> > comparison? And what version of Cayenne is that?
> >
> > Andrus
> >
> >
> > On Dec 4, 2006, at 1:52 PM, Juergen Saar wrote:
> >
> > > Hi,
> > >
> > > if I use
> > >
> > > public static void *orderList*(java.util.List objects,
> > >                             java.util.List orderings)
> > >
> > >
> > > from the Ordering-Class for sorting date-values it behaves like a
> > > toString()
> > > from the date-values is sorted and so it's a order-by-day and not a
> > > order-by-date.
> > >
> > > Is there anything I can do?
> > > --- Juergen ---
> >
> >
>
>

Re: Problem: Ordering.orderList and date-values

Posted by Juergen Saar <ju...@jsaar.org>.
I didn't expect toString() to be involved, but it was the easiest way to
explain the sorting result.

Currently I'm working with version 1.2.1 ... the problem is also in 1.1.4

What I'm doing, is sorting a relation-list ... a kind of events of an order.
Converting the Date with SimpleDateFormat("yyyyMMdd") to a comparable String
should  be no problem, but I need a hint how I can clue this String to the
List ...

BTW: I'm preparing for Cayenne 2.0.1, but converting all packagenames from
org.objectstyle to org.apache is not really fun ... any hints how this can
be done without too many keyboard-action?  (There are about 2000 Classes in
our cayenne based projects)

2006/12/4, Andrus Adamchik <an...@objectstyle.org>:
>
> java.lang.Comparable is used to order Date fields. "toString" is not
> involved anywhere on Cayenne end. Is there a chance you are
> converting the values to Strings yourself before doing the
> comparison? And what version of Cayenne is that?
>
> Andrus
>
>
> On Dec 4, 2006, at 1:52 PM, Juergen Saar wrote:
>
> > Hi,
> >
> > if I use
> >
> > public static void *orderList*(java.util.List objects,
> >                             java.util.List orderings)
> >
> >
> > from the Ordering-Class for sorting date-values it behaves like a
> > toString()
> > from the date-values is sorted and so it's a order-by-day and not a
> > order-by-date.
> >
> > Is there anything I can do?
> > --- Juergen ---
>
>

Re: Problem: Ordering.orderList and date-values

Posted by Juergen Saar <ju...@jsaar.org>.
1 additional information:

The orderList method is call with 2 sort criteria 1. Date, 2. Short


2006/12/4, Andrus Adamchik <an...@objectstyle.org>:
>
> java.lang.Comparable is used to order Date fields. "toString" is not
> involved anywhere on Cayenne end. Is there a chance you are
> converting the values to Strings yourself before doing the
> comparison? And what version of Cayenne is that?
>
> Andrus
>
>
> On Dec 4, 2006, at 1:52 PM, Juergen Saar wrote:
>
> > Hi,
> >
> > if I use
> >
> > public static void *orderList*(java.util.List objects,
> >                             java.util.List orderings)
> >
> >
> > from the Ordering-Class for sorting date-values it behaves like a
> > toString()
> > from the date-values is sorted and so it's a order-by-day and not a
> > order-by-date.
> >
> > Is there anything I can do?
> > --- Juergen ---
>
>

Re: Problem: Ordering.orderList and date-values

Posted by Andrus Adamchik <an...@objectstyle.org>.
java.lang.Comparable is used to order Date fields. "toString" is not  
involved anywhere on Cayenne end. Is there a chance you are  
converting the values to Strings yourself before doing the  
comparison? And what version of Cayenne is that?

Andrus


On Dec 4, 2006, at 1:52 PM, Juergen Saar wrote:

> Hi,
>
> if I use
>
> public static void *orderList*(java.util.List objects,
>                             java.util.List orderings)
>
>
> from the Ordering-Class for sorting date-values it behaves like a  
> toString()
> from the date-values is sorted and so it's a order-by-day and not a
> order-by-date.
>
> Is there anything I can do?
> --- Juergen ---