ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Pauli" <ke...@thepaulis.com>
Subject queryForList is returning a List of Lists?
Date Fri, 18 Aug 2006 19:42:06 GMT
Hello, I am new to SQLMaps and I am evaluating version 2.2.0 for a new
project.  I have searched for an answer to the following problem but no joy
(probably b/c everybody knows the answer already and I am thick)

I have an abstract base class Animal, with attributes "id" and "name", and a
subclass LandAnimal that adds an attribute "numberOfFeet".

I have a table-per-subclass schema, with the following maps:

    <resultMap class="Animal" id="AnimalResult">
        <result property="id" column="animal_id"/>
        <result property="name" column="name"/>

    <resultMap class="LandAnimal" id="LandAnimalResult">
        <result property="numberOfFeet" column="num_feet"/>

Here is my select statement to join the two tables and retrieve LandAnimals
by number of feet:

    <select id="getLandAnimalByNumberOfFeet" resultClass="LandAnimal"
resultMap="AnimalResult, LandAnimalResult">
        SELECT * FROM animals, land_animals
        WHERE animal_id = land_animal_id AND num_feet = #value#

For some reason I cannot fathom, queryForList("getLandAnimalByNumberOfFeet",
4) is returning a List of Lists of LandAnimals, instead of just a List of
LandAnimals.  And queryForObject() returns a List of LandAnimals, instead of
just the first LandAnimal.  Is this the expected behavior?  It does not seem

Kevin Pauli

View raw message