ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samnang Chhun <samnang.ch...@gmail.com>
Subject Complex Property Error
Date Thu, 19 Jul 2007 02:26:37 GMT
Hi all,

 

I want to load data from the database and fill to object by using complex
properties, but I get an error when I execute.

I have 3 classes:

 

class1

{

                public  int _id;

                public string _name;

                public class2 _address;

}

 

class2

{

                public string _postalCode;

                public string _country;

                public List<class3> _addressLines;

}

 

class3

{

                public string _type;

                public string _value;

}

I have a sqlMap.xml :

<resultMaps>

                <resultMap id="rmSelectClass1" class="Class1">

                   <result property="_id" column="ID"/>

                   <result property="_name" column="Name"/>

                   <result property="_address._postalCode"
column="PostalCode"/>

                   <result property="_address._country" column="Country"/>

                   <result property="_address._addressLines" column="_id"
select="SelectClass3"/>

                </resultMap>

                

                <resultMap id="rmSelectClass3" class="Class3">

                  <result property="_type" column="type" />

                  <result property="_value" column="value" />

                </resultMap>

</resultMaps>

 

<statements>

    <select id="SelectClass1ByID" resultMap="rmSelectClass1"
parameterClass="int">

                 SELECT id,Name,PostalCode,Country FROM vPerson WHERE id =
#value#

   </select>

                                

  <select id="SelectClass3ByPersonID" resultMap="rmSelectClass3"
parameterClass="int">

                SELECT type,value FROM addressLines WHERE person_id =
#value#

 </select>

</statements>

 

When I'm runing my test I'm getting following error:

System.ArgumentException: Field '_addressLines' defined on type 'class2' is
not a field on the target object which is of type 'class1'.

Any help?

Thanks,

 


Mime
View raw message