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 l4r5 <ma...@usherbrooke.ca> on 2006/05/08 17:12:59 UTC

Complex properties and stored procedures...

Hi everyone,

I have a nested query...(Client having multiple addresses) but which uses
stored procedures, problem is that the two parameters that are retrieved
form the first query (client_id and current_address_id) are not being passed
to the parameterMap on the getAddresses query(they are both null as shown by
the debug statements below).

Does anybody have an idea how to make this work?

DEBUG [main] - {conn-100005} Connection
DEBUG [main] - {pstm-100006} PreparedStatement: { call
client_auth_clientNo_pr(?, ?, ?, ?) }
DEBUG [main] - {pstm-100006} Parameters: [10489747, WALSWORTH, 1972-06-11
00:00:00.0, 1905]
DEBUG [main] - {pstm-100006} Types: [java.lang.Integer, java.lang.String,
java.sql.Timestamp, java.lang.Integer]
DEBUG [main] - {rset-100007} ResultSet
DEBUG [main] - {pstm-100008} PreparedStatement: { call client_address_pr(?,
?) }
DEBUG [main] - {pstm-100008} Parameters: [null, null]
DEBUG [main] - {pstm-100008} Types: [null, null]

  <parameterMap id="parameterMapClient" class="java.util.HashMap">
    <parameter property="id" jdbcType="INT" javaType="java.lang.Integer"
mode="IN"/>
    <parameter property="name" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN"/>
    <parameter property="dob" jdbcType="DATETIME" javaType="java.util.Date"
mode="IN"/>
    <parameter property="cob" jdbcType="INT" javaType="java.lang.Integer"
mode="IN"/>
  </parameterMap>
 
  <resultMap id="resultMapClient" class="Client">
    <result property="id" column="client_id" />
    <result property="surName" column="family_nme" />
    <result property="givenName" column="given_nme" />
    <result property="birthDt" column="birth_dt" />
    <result property="birthCountryId" column="birth_country_id" />
    <result property="addresses" column="{client_id, current_address_id}"
select="getAddresses" />
  </resultMap>
  
   <procedure id="getClientById" 
             parameterMap="parameterMapClient" 
             resultMap="resultMapClient">
    { call client_auth_clientNo_pr(?, ?, ?, ?) }
  </procedure>
  
 <parameterMap id="parameterMapAddress" class="java.util.HashMap">
    <parameter property="clientId" jdbcType="INT"
javaType="java.lang.Integer" mode="IN"/>
    <parameter property="addressId" jdbcType="INT"
javaType="java.lang.Integer" mode="IN"/>
  </parameterMap>
  
  <resultMap id="resultMapAddress" class="Address">
    <result property="type" column="type_cd" />
    <result property="subType" column="sub_type_cd" />
    <result property="streetNo" column="street_no" />
    <result property="streetAddress1" column="first_ln" />
    <result property="streetAddress2" column="second_ln" />
    <result property="city" column="city_nme" />
    <result property="country" column="country_long_desc" />
    <result property="province" column="province_long_desc" />
    <result property="postalZipCode" column="postal_zip_cd" />
    <result property="effectiveDt" column="effective_dt" />
  </resultMap>
  
  <procedure id="getAddresses" 
             parameterMap="parameterMapAddress"
             resultMap="resultMapAddress">
    { call client_address_pr(?, ?) }
  </procedure>
--
View this message in context: http://www.nabble.com/Complex-properties-and-stored-procedures...-t1577441.html#a4282394
Sent from the iBATIS - User - Java forum at Nabble.com.