ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nic Werner <wer...@sonoma.edu>
Subject Queries that don't fit in a Bean
Date Mon, 11 Apr 2005 22:29:09 GMT
    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">
        FROM device,person
        where device.owner = person.regid
        <isParameterPresent prepend="and">
        tag = #tag#

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?


- Nic.

View raw message