What if you create the object and pass it as the parameter instead of using
a Map?  Change your parameterMap to use class="BanPolicy", then...

BanPolicy bp = new BanPolicy();
bp.setBanPolicyId(33);
getSqlMapClientTemplate().queryForList("fetch-ban-policy-by-id", bp);
return bp;

Jeff Butler


On 4/12/07, Paul Sanders <[EMAIL PROTECTED]> wrote:


[At this rate I fear I'm going to be asking about every stored procedure
in
my database but hopefully not...]

I have this definition for my a stored procedure:

Procedure getBanPolicyById (
piBanPolicyId in number,
poApplicationId out number,
poMinBanCount out number,
poMaxBanCount out number,
poAccountBandays out number,
poDnasBandays out number,
poBanReasonID out number,
poDidSucceed out number);

So I wrote some XML:

  <parameterMap id="fetch-ban-policy-by-id" class="map">
      <parameter property="banPolicyID" jdbcType="INTEGER" mode="IN" />
      <parameter property="applicationID" jdbcType="INTEGER" mode="OUT" />
      <parameter property="minBanCount" jdbcType="INTEGER" mode="OUT" />
      <parameter property="maxBanCount" jdbcType="INTEGER" mode="OUT" />
      <parameter property="accountBanDays" jdbcType="INTEGER" mode="OUT"
/>
      <parameter property="dnasBanDays" jdbcType="INTEGER" mode="OUT" />
      <parameter property="banReasonId" jdbcType="INTEGER" mode="OUT" />
      <parameter property="didSucceed" jdbcType="INTEGER" mode="OUT" />
  </parameterMap>

  <procedure id="fetch-ban-policy-by-id"
parameterMap="fetch-ban-policy-by-id"  >
     { call getBanPolicyById(?,?,?,?,?,?,?,?) }
  </procedure>

and a test method:

public void fetchBanPolicyById(Integer policyId)
{
       Map map = new HashMap();
       map.put("banPolicyID", policyId);

       getSqlMapClientTemplate().queryForList("fetch-ban-policy-by-id",
map);
       System.out.println(map.toString());
}

The printed map is everything I expect.

My question is: is there any way to have the framework create the
BanPolicy
object from the first 7 values in the map? My understanding is that a
resultMap only works with a resultSet but thats not how the sproc was
written.

Thanks again

Paul
--
View this message in context:
http://www.nabble.com/New-Stored-Proc-Question---Creating-a-Bean-From-Partial-Results-tf3567480.html#a9965793
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Reply via email to