Arrays are not supported, use a List and it'll be fine.

Larry


On 11/2/06, Goel, Sachin <[EMAIL PROTECTED]> wrote:




Hi

I am having tough time in loading a complex property structure using iBatis
with Java 1.4.

I have got an array[addInfo] in top level object[Person], this array has
custom object[AddInfo] which has an object as property[Value].

The objective is to write sql-map in such a way that select query returns
one/list of person object(s) with array and all nested objects populated
with appropriate data.


Table : Person
Name : Varchar2
Age : Number
HomeTown : int
Status : int

Table : Home Town
Id : Int
Name : Varchar2


Table : Status
Id : int
Value : Varchar2


Object :
Person
{
        String name;
        int age;
        AddInfo[] addInfo;
}


AddInfo{
        String Type;
        Value val;
}


Value {
int id;
String value;
}

The idea is to keep object structure flexible so that other types may be
added later(current one being : Home Town and Status]  with out changing
object structure, but in database they are stored as direct column values.

Result map is
        <resultMap id="persons" class="com.fil.bo.Person">
                <result property="name" column="name"/>
                <result property="age" column="age"/>
        </resultMap>

SQL is
<select id="getPersons" resultMap="persons"
parameterClass="com.fil.so.SearchPerson">
        SQL query with joins and dynamic clause
</select>

The point I am struggling is how to specify array and nested object in
result map and get them populated using iBatis.


Any help/Pointers, greatly appreciated.


Thanks and Regards
Sachin

Reply via email to