This looks like it should work to me.  So we're both missing something.  I think that turning on logging would help - we could see some more information about what's coming from and going to the database.  The latest developers guide has some detailed information about turning on logging if you don't know how to do it.
 
Jeff Butler


 
On 8/17/06, jaybytez <[EMAIL PROTECTED]> wrote:

Thanks for your help.  I am using iBatis 2.1.7.

If I use the following configuration (just the keyProperty attribute), I get
a unique key constraint violation because it still is not putting the
keyProperty value into the parameter property.  "id" is set to 0 (since its
a long in ContactTO), and that is the value being pushed to the database.
But if I run my nextval query against the sequence separately...I get the
next sequence number.  I can't figure out where the miss fire is happening.

   <parameterMap id="hbaContactParameters" class=" com.foo.to.ContactTO">
       <parameter property="id" jdbcType="NUMERIC"/>
       <parameter property="tscName" jdbcType="VARCHAR"/>
       <parameter property="contactName" jdbcType="VARCHAR"/>
       <parameter property="contactDate" jdbcType="DATE"
javaType="dateTime"/>
       <parameter property="issueResolvedIndicator" jdbcType="NUMERIC"/>
       <parameter property="followUpRequiredIndicator" jdbcType="NUMERIC"/>
       <parameter property="followUpRequiredDescription"
jdbcType="VARCHAR"/>
       <parameter property="contactTypeDescription" jdbcType="VARCHAR"/>
       <parameter property="contactReasonTypeDescription"
jdbcType="VARCHAR"/>
       <parameter property="contactType" jdbcType="NUMERIC"
javaType="com.foo.to.ContactType "/>
       <parameter property="contactMethodType" jdbcType="NUMERIC"
javaType="com.foo.to.ContactMethodType"/>
       <parameter property="contactReasonType" jdbcType="NUMERIC"
javaType="com.foo.to.ContactReasonType"/>
   </parameterMap>

   <insert id="insertHBAContact"
       parameterMap="hbaContactParameters">
       <selectKey keyProperty="id">
           <![CDATA[
               SELECT hba_contact_seq.NEXTVAL FROM DUAL
           ]]>
       </selectKey>

       <![CDATA[
           INSERT INTO hba_contact_hbc
               ( hbc_contact_id, hbc_tsc_name, hbc_contact_name,
hbc_contact_date,
                 hbc_issue_resolved_ind, hbc_follow_up_required_ind,
                 hbc_follow_up_required_desc, hbc_contact_type_desc,
                 hbc_reason_desc, hbc_fk_contact_type_id,
hbc_fk_contact_method_id,
                 hbc_fk_contact_reason_id )
           VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
       ]]>
   </insert>

Thanks,

jay
--
View this message in context: http://www.nabble.com/selectKey-and-parameterMap-issue-tf2118776.html#a5854352
Sent from the iBATIS - User - Java forum at Nabble.com.


Reply via email to