ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nic Werner <wer...@sonoma.edu>
Subject Re: Nested Beans?
Date Tue, 12 Apr 2005 21:29:52 GMT
Okay, that makes sense, and now it is using the correct bean setter for 
the nested property.

Now, is there a way to trigger iBATIS to take this ID #, and populate 
the whole nested bean? I see in the documentation under 'Complex 
Properties', a similiar idea, but the example shows taking multiple 
queries and populating one large item, not an item with nested ones.

- Nic.


Larry Meadors wrote:

> There is not a property named 'Tag' in class 'java.lang.String' only 
> in your bean. :-D
>
> Change the result maping.
>
> Larry
>
> On Apr 12, 2005 2:33 PM, *Nic Werner* <werner@sonoma.edu 
> <mailto:werner@sonoma.edu>> wrote:
>
>     Yes,  public void setTag(String value){tag = value; }
>
>     Caused by: com.ibatis.common.beans.ProbeException: There is no
>     WRITEABLE
>     property named 'Tag' in class 'java.lang.String'
>
>     I tried changing the capitalization and same response.
>
>     Brandon Goodin wrote:
>
>     >does your device bean have a setTag(...) method?
>     >
>     >On Apr 12, 2005 12:44 PM, Nic Werner <werner@sonoma.edu
>     <mailto:werner@sonoma.edu>> wrote:
>     >
>     >
>     >>Thanks for the guidance Brandon, but I'm still lost after checking
>     >>everything: I want this 'select' command to grab the deviceid, and
>     >>populate the DeviceBean using this unique tag, is that possible?
>     >>
>     >>ReservationBean holds a DeviceBean. The DB table has a field called
>     >>'DeviceID' which should refer to the DeviceBean.getTag()
>     >>
>     >>I get the error:  Caused by: com.ibatis.common.beans.ProbeException:
>     >>There is no WRITEABLE property named 'tag' in class
>     'java.lang.String'
>     >>
>     >>Snippet of my ReservationBean:
>     >>public final class ReservationBean extends ActionForm {
>     >>
>     >>        private String ipAddress="";
>     >>        private DeviceBean device = new DeviceBean();
>     >>....
>     >>
>     >>Reservation.xml:
>     >><resultMap id="ReservationBean"
>     >>class="com.company.beans.dhcp.ReservationBean">
>     >>        <result property="ipAddress" column="ipaddress"/>
>     >>        <result property="device.tag" column="deviceid"/>
>     >>    </resultMap>
>     >>    <select id="selectReservations" resultMap="ReservationBean">
>     >>        SELECT
>     >>            deviceid,
>     >>            ipaddress
>     >>        FROM dhcp_reservation
>     >>    </select>
>     >>---------------------
>     >>
>     >>- Nic.
>     >>
>     >>
>     >>Brandon Goodin wrote:
>     >>
>     >>
>     >>
>     >>>You can use '.'  (dot) notation. So, if you pass in Reservation as
>     >>>your parameter class you can acess the device id with 'device.id'
>     >>>(assuming 'id' is the name of your id propety in the Device class)
>     >>>
>     >>>Brandon
>     >>>
>     >>>On Apr 7, 2005 12:58 PM, Nic Werner <werner@sonoma.edu
>     <mailto:werner@sonoma.edu>> wrote:
>     >>>
>     >>>
>     >>>
>     >>>
>     >>>>Greetings,
>     >>>>   The archives aren't searchable right now
>     >>>>(http://incubator.apache.org/ibatis/site/mailinglists.html),
>     so I have
>     >>>>this question:
>     >>>>
>     >>>>I have a Bean (Reservation), with another Bean (Device) inside
>     it. My
>     >>>>database just contains the DeviceID in the Reservation table -
>     where/how
>     >>>>can I use the getter inside the nestedbean to get this
>     DeviceID out?
>     >>>>
>     >>>>Thanks,
>     >>>>
>     >>>>- Nic.
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>
>     >>
>
>


Mime
View raw message