I think this is because you don't have it in the insert statement like this...

INSERT INTO hba_contact_hbc 
       (id, 
	hbc_contact_id, 
	hbc_tsc_name, 
	hbc_contact_name,
	hbc_contact_date,
        etc...

if the property you're trying to use as the id is hbc_contact_id you'll need the selectKey to look like this: 
        <selectKey resultClass="long" keyProperty="hbc_contact_id">
                SELECT hba_contact_seq.NEXTVAL FROM DUAL
        </selectKey>

And then have the insert as you already have it defined.
Diran

jaybytez wrote:
And if I put it into the id (from selectKey) into my parameterMap like the
following, it does not push the result of the selectKey query into the
insert statement:

    <parameterMap id="hbaContactParameters"
class="com.healthnet.hnfs.hba.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 resultClass="long" 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>
  

Reply via email to