You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Rutherford, Matthew [CIB-IT]" <ma...@citigroup.com> on 2006/11/03 12:15:14 UTC

Ibatis not returning any results

Hi I am using Ibatis SQL Maps 2.1.7

Currently I have the following query in my SqlMapItemDao:

getSqlMapClientTemplate().queryForList("getLatestItemByFii", item);

The sql map looks like:

<resultMap id="result" class="Item">
  	<result property="Id" column="id" columnIndex="1"/>
  	<result property="currencyCode" column="currency_code" columnIndex="2"/>
  	<result property="fii" column="fii" columnIndex="3"/>
  	<result property="positionAsAt" column="position_as_at" columnIndex="4"/>  	
	<result property="pos" column="pos" columnIndex="5"/>
</resultMap>

<select id="getLatestPositionByFii" resultMap="result">
    SELECT id,currency_code,fii, to_char(max(position_as_at)), pos
    FROM item
    WHERE fii = #fii# and pos != 0
    GROUP BY id,currency_code,fii,pos
</select>

with sql debugging turned on, there is no error msg returned.

If I try the same query in my sql client app I get 1 row of data back.  But the queryForList() returns nothing to me, and I logged the item object's variables to make sure it was the same parameter.  It is.  Why is the List not being populated with the same data?

Thanks for any insight,
Matt

Re: Ibatis not returning any results

Posted by Ma...@prolifics.de.
Looks like the parameterClass option is missing in the select.

Cheers
Marc

"Rutherford, Matthew [CIB-IT]" <ma...@citigroup.com> schrieb 
am 03.11.2006 12:15:14:

> Hi I am using Ibatis SQL Maps 2.1.7
> 
> Currently I have the following query in my SqlMapItemDao:
> 
> getSqlMapClientTemplate().queryForList("getLatestItemByFii", item);
> 
> The sql map looks like:
> 
> <resultMap id="result" class="Item">
>      <result property="Id" column="id" columnIndex="1"/>
>      <result property="currencyCode" column="currency_code" 
columnIndex="2"/>
>      <result property="fii" column="fii" columnIndex="3"/>
>      <result property="positionAsAt" column="position_as_at" 
> columnIndex="4"/> 
>    <result property="pos" column="pos" columnIndex="5"/>
> </resultMap>
> 
> <select id="getLatestPositionByFii" resultMap="result">
>     SELECT id,currency_code,fii, to_char(max(position_as_at)), pos
>     FROM item
>     WHERE fii = #fii# and pos != 0
>     GROUP BY id,currency_code,fii,pos
> </select>
> 
> with sql debugging turned on, there is no error msg returned.
> 
> If I try the same query in my sql client app I get 1 row of data 
> back.  But the queryForList() returns nothing to me, and I logged 
> the item object's variables to make sure it was the same parameter. 
> It is.  Why is the List not being populated with the same data?
> 
> Thanks for any insight,
> Matt