wait, I didn't see what you were doing with the parameter map.  Anyway, how I got it to work is by naming the properties in the values part of the insert statement with their domain object names.  Including the one I substitute with the selectKey.  Like this:

<insert id="insertMetricDocument" parameterClass="MetricDocument">
        <selectKey resultClass="string" keyProperty="documentId">
            select SC_METRIC_DOCUMENTS_ID.NextVal from dual
        </selectKey>
        insert into SC_METRIC_DOCUMENTS (
             METRIC_ID,
             DOCUMENT_ID,
             VERSION,
             DOCUMENT_NAME,
             DESCRIPTION,
             FILE_EXTENSION,
             DOCUMENT,
             UPDATE_DATE,
             UPDATED_BY)
        values (
            #metricId#,
            #documentId:NUMERIC#,
            #version#,
            #documentName:VARCHAR#,
            #description:VARCHAR#,
            #fileExtension:VARCHAR#,
            #document#,
            sysdate,
            #updatedBy.employeeNumber#
            )
    </insert>


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