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>
<resultMap class="LandAnimal" id="LandAnimalResult">
<result property="numberOfFeet" column="num_feet"/>
</resultMap>
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#
</select>
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 intuitive.
--
Regards,
Kevin Pauli
- queryForList is returning a List of Lists? Kevin Pauli
- Re: queryForList is returning a List of Lists? Jeff Butler
- Re: queryForList is returning a List of Lists? Kevin Pauli
