Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Active Objects handles multiple columns in order clause?

angel November 10, 2011

Probably a bug but I thought I should ask first. When trying to a second column in the order clause in Active Object query I get an exception about a missing column:

Caused by: org.postgresql.util.PSQLException: ERROR: column "unit" does not exist

Maybe a PLSQL specific issue. I'm using ao 0.7.12.1 with JIRA 4.4.3

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Stefan Forstmoser _beecom_ October 7, 2014

I had the same problem with Postgres. The trouble is, that upper case table and field names have to be put between double quotes for Postgres. (And ActiveObject creates table and field names all upper case.) Unfortunately the ActiveObject API does not handle this fully transparent.

With this:

.order("FIRST ASC, SECOND ASC")

I got some '... column "second" does not exist' error.

Surprisingly the following worked:

.order("FIRST ASC, \"SECOND\" ASC")

It seems, that only the first order field is put into double quotes within the API. I finally decided to make it at least a bit more consistent like this:

.where("... ORDER BY \"FIRST\" ASC, \"SECOND\" ASC")
 

This is with ActiveObejcts version 0.19.12 .

0 votes
Remo Siegwart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2011

How do you create the query? I don't have the chance to test it on PLSQL at the moment, but I can confirm that the following works in MySQL & HSQLDB:

Query.select().order("FIRST ASC, SECOND DESC")

Hope this helps

TAGS
AUG Leaders

Atlassian Community Events