Icon
Maintenance Notice: The answers.atlassian.com site will undergo maintenance from 01:00 - 02:00 UTC on 30 July 2015. During this maintenance window the site will be offline and unavailable. We apologize for any inconvenience. Hide
 
2
1
0

I have an AO entity with lifecycle info like 'created' (Timestamp type) and a data entity that extends it. I want to use AO to retrieve the data entities, ordered with most recent dates first. If I try the following:

Query query=Query.select().order("created");
MyObj[] = aoService.find(MyObj.class,query);

I get: ERROR: column "created" does not exist Position: 58 at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:251)

But, the table does have a Timestamp column, A bug possibly? Even if this worked, Im curious how I would indicate 'ascending' or 'descending' orders.

Anyone got an example to hand?

Rgds

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      It looks like a case sensitivity issue to me. Some database are case sensitive, Postgres being one of them. And all table and column names converted by the AO plugin are upper case.

      See the table names and column names conventions for more information.

      In your case I think simply changing your code to the following should work.

      Query.select().order("CREATED")

      1. Andy Brook

        Hi Sam, I should have thought of that, upper casing worked. If AO coverts all columns to upper case, it would be a wrinkle removed if column operations shouldnt be case sensitive?

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Andy, you should be able to do

      Query.select().order("created asc") 
      Query.select().order("created desc")
      

      Try it, if that's not working then there may be a bug

      1. Andy Brook

        Hi James,

        Thanks for that, looks like the fundamental problem is the inheritance, logged as https://studio.atlassian.com/browse/AO-295

      CommentAdd your comment...