db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject Re: sort by one column minus another column
Date Tue, 04 Apr 2006 15:19:36 GMT
Most probably, the problem is one of the following:

- Torque tries to get a column name in the format TableName.ColumnName out
of the argument and does some heuristic guessing, which does not seem to
cover your case. Sadly, there is no central place where this is done, so it
is done differently in different places :-(. Changing this would need a
big-scale reworking of the internal logic of Torque's SQL generation.
However, you could try to improve  the guesswork for ther OrderBy-Columns
to guess correctly in your case.

- For some databases, the expression which is ordered by would need to be
added as a select column. Maybe this is missing.

Ah, now some hack comes to my mind which might work:

criteria.addAsColumn("myOrderBy", "(" + SomeTablePeer.COLUMN_B +" - " +
SomeTablePeer.COLUMN_A + ")");
criteria.addAscendingOrderByColumn("myOrderBy");

Maybe you have to leave out the brackets.

     Thomas

John Dunne <imirish@alldunne.com> schrieb am 04.04.2006 16:54:05:

> I already tried your first suggestion, which failed. I just tried out
> your second suggestion but that's failed also. I may look at editing the
> code to see if I can get it to work, as I could do with this sorting
option!
>
> Thanks for your help Thomas,
>
> john.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message