ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: Queries that don't fit in a Bean
Date Tue, 12 Apr 2005 00:29:51 GMT
There are a couple ways to deal with this. You could return everything
in a map and avoid the use of the object. This is a generally good
practice when you are displaying a list that requires human readable
values instead of generated ids.

On Apr 11, 2005 4:29 PM, Nic Werner <werner@sonoma.edu> wrote:
> Greetings,
>     This is partially a best practice question, and a technical one.
>     I was using one 'select' statement for two uses, to grab an
> individual device, and to grab a list of devices:
> <select id="selectDevice" resultClass="DeviceBean">
>         SELECT
>             *
>         FROM device,person
>         where device.owner = person.regid
>         <isParameterPresent prepend="and">
>         tag = #tag#
>         </isParameterPresent>
>     </select>
> When I do a list of Devices, I use queryForList and a List, but an
> indvidual device is queryForObject and a DeviceBean.
> The problem is that there is more data being returned then is in the
> DeviceBean and I want to display it also. However, I really only want to
> use it for the list of Devices, not an individual Device. Is there a way
> to do this in one 'select' statement, or do I need to use two and use a
> different resultClass for the list of them?
> Thanks,
> - Nic.

View raw message