ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gwyn Evans" <gwyn.ev...@gmail.com>
Subject Re: abator: dynamic order by
Date Fri, 11 Aug 2006 11:09:50 GMT
I think you're almost there, but note that you need "$value$" rather
than "#value#" there.

Maybe compare with the code here
(http://www.wicket-wiki.org.uk/wiki/index.php/IBATIS#Oracle_paging)
and see the 'notes' at the end of the section

/Gwyn

On 11/08/06, Thomas Karl Schwaerzler <Thomas.Schwaerzler@uibk.ac.at> wrote:
>
>
> hello,
>
> i'm looking for something that allows me to use a dynamic order by value
> in abator.
> the method could look something like this:
>
> List<Customer> getCustomersOrdered(Long groupId, String orderColumn,
> String ascDesc)
>
>
> ..where orderColumn is a column name and ascDesc is either 'ASC' or 'DESC'
>
> in this mailinglist i found someone seemingly looking for something
> similar just using ibatis:
>
> http://www.mail-archive.com/user-java@ibatis.apache.org/msg05010.html
>
>
> You can add this to your select statement:
>
>      <isNotEmpty property="orderByColumn">
>        order by $orderByColumn$
>      </isNotEmpty>
>
> Then add a getOrderByColumn() method to your parameter object.
>
> Jeff Butler
>
>
> this works, i just had to add an extra class only containing orderByColumn
> + getter ...
>
>
> my 1. attempt was something like this:
>
> <select id="getCustomersOrdered" parameterClass="java.lang.String"
> resultMap="abatorgenerated_OdmCustomerResult">
>      select ID,
>        TITLE,
>        FIRST_NAME,
>        LAST_NAME,
>        STREET,
>        ZIP_CODE,
>        CITY,
>        COUNTRY,
>        PHONE_MOBILE,
>        PHONE,
>        FAX,
>        EMAIL,
>        GROUP_ID
>      from c108272dev.ODM_CUSTOMER
>      order by #value#
> </select>
>
>
> where the parameter contained e.g. "FIRST_NAME ASC"
>
> but this did not deliver the expected result.
>
>
> my question is:
>
> is there a more comfortable way to to something like this with abator?
>
>
> thnx in advance
> tom :)
>


-- 
Download Wicket 1.2.1 now! - http://wicketframework.org

Mime
View raw message