cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: Example of an order by clause on a query
Date Fri, 06 May 2011 18:44:43 GMT
Hi Tony,

SelectQuery query = new SelectQuery(Event.class);
query.addOrdering(new Ordering(Event.SOME_PROPERTY, SortOrder.ASCENDING));
List<Event> values = context.performQuery(query);

mrg


On Fri, May 6, 2011 at 2:28 PM, Tony Dahbura <dahbuan@aopslab.com> wrote:
> I am trying to find an example of using an order by on a cayenne query. I was hoping
to have it sort the information using the database versus locally which cayenne seems to support
either.
>
> My example is I need to do a select * from event order by name ascending.
>
> How do I build such a query:
>
> SelectQuery query = new SelectQuery(Event.class);
> //what goes in here to sort by some field in the object to order it
> query.addOrdering();
> List<Event> values = context.performQuery(query);
>
>
> Thanks,
> Tony
>
>

Mime
View raw message