cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andre Lomonaco" <andrelomon...@gmail.com>
Subject Using SQL ABS
Date Sat, 24 Jul 2010 22:19:06 GMT
      Hi Everyone,

      I'm newbie in Cayenne and I will apreciate if someone can help me in one question..

      I have a table with a VARIACAO Field (Type DOUBLE)         
      I can store in this Field Positive and Negative Numbers

      When I execute the following code, it's return to me first the Negative values and after
the Positive values

      SelectQuery query = new SelectQuery(RiscoTotal.class);
      query.addOrdering(RiscoTotal.VARIACAO_PROPERTY,true);

       ObjectContext context = BaseContext.getThreadObjectContext();
       List<RiscoTotal> riscoTotal = context.performQuery(query);

       Return: -12.0, -6.0, 3.0, 15.0

       My questions is:

       How can I do to make a query to return only the ABS value
       I wanna receive the following results

       15.0, -12.0, -6.0, -3.0

       My Best Regards,

       Andre Lomonaco
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message