ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Stored Procedure Call Returns Empty List But Does Create Beans
Date Wed, 11 Apr 2007 20:25:58 GMT
The list is not returned from the queryForList method because the resultSet
is an output parameter - not a resultSet from the procedure call.  So you
need to try something like this:

Map parms = new HashMap();
getSqlMapClientTemplate().update("fetch-ban-policies", parms);
return parms.get("o");

Jeff Butler


On 4/11/07, Paul Sanders <tendancer@gmail.com> wrote:
>
>
> [Hate to post again so quickly, I used to think I knew what I was doing in
> this space but it seems not.... hopefully someone can help me here and
> then
> I promise to go away.]
>
> I have a stored procedure that is just a wrapper around a "SELECT *" and I
> have straight JDBC code that uses it and works. So I'm trying to move to
> Spring/iBATIS - my code to execute the query runs but the returned List
> object is empty. If I log each constructor call and setter call I get the
> appropriate output - the beans are being created, and with the right
> values,
> but somehow aren't being returned in the List. Is this a common beginners
> mistake??
>
> Not sure how much of the code is valuable but here is some...
>
> public List<BanPolicy>fetchBanPolicies()
> {
>   return getSqlMapClientTemplate().queryForList("fetch-ban-policies"); //
> returns empty list
> }
>
> the mapping file...
>
> <resultMap class="BanPolicy" id="fetch-ban-policies-map">
>       <result property="banPolicyID" columnIndex="1" javaType="int" />
>       <result property="applicationID" columnIndex="2" javaType="int" />
>       <result property="minBanCount" columnIndex="3" javaType="int" />
>       <result property="maxBanCount" columnIndex="4" javaType="int" />
>       <result property="accountBanDays" columnIndex="5" javaType="float"
> />
>       <result property="dnasBanDays" columnIndex="6" javaType="float" />
>       <result property="banReasonId" columnIndex="7" javaType="int" />
>   </resultMap>
>
>   <parameterMap id="fetch-ban-policies-rs" class="map">
>       <parameter property="o" javaType="java.sql.ResultSet"
> jdbcType="ORACLECURSOR" mode="OUT" resultMap="fetch-ban-policies-map" />
>   </parameterMap>
>
>   <procedure id="fetch-ban-policies" parameterMap="fetch-ban-policies-rs">
>      { call .getBanPolicies(?) }
>   </procedure>
>
> and the spring deftn.....
>
>   <bean id="banPolicyDAO"
> class="persistence.dao.managers.BanPolicyManager">
>        <property name="sqlMapClient" ref="sqlMapClient"/>
>   </bean>
>
> I'm going to do a hard coded SQL version just to get something working
> today....
>
> Cheers
>
> Paul
> --
> View this message in context:
> http://www.nabble.com/Stored-Procedure-Call-Returns-Empty-List-But-Does-Create-Beans-tf3561741.html#a9947480
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Mime
View raw message