ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James, Steven" <steven.ja...@logicacmg.com>
Subject RE: <selectKey> doesn't send the value to insert statement
Date Fri, 14 Oct 2005 10:05:52 GMT
set the KeyProperty of the selectKey (See developer guide sqlmaps-2.pdf paage 14
 and set is to the java bean property you wish to be set.. This is why you do not see the
value being passed in. Running the selectKey first is ok..
 
Steve..

________________________________

From: Farsi, Reza [mailto:Reza.Farsi@SUNGARD.DE]
Sent: Fri 14/10/2005 10:56
To: user-java@ibatis.apache.org
Subject: AW: <selectKey> doesn't send the value to insert statement


Hi Karthikeyan ,
 
select key should follow INSERT.
 
Reza

________________________________

Von: Karthikeyan Pandurangan [mailto:pkarth@gmail.com]
Gesendet: Fr 14.10.2005 08:30
An: user-java@ibatis.apache.org
Betreff: <selectKey> doesn't send the value to insert statement



Hi,
     I am stuck with the problem in <selectKey> & insert statement usage.

My insert statement.

<insert id="insertDonorInfo">
       <selectKey resultClass="java.lang.String" >
         SELECT to_char(FN_GETDONORID) AS "strDonorID" FROM DUAL
       </selectKey>
        INSERT INTO DONOR (
        DONOR_ID,
        CATEGORY,
         CREATED_BY,
         DATE_CREATED
        )
        VALUES (
        #strDonorID:VARCHAR#,
        #strCategory#,
         #strCreatedBy#,
        sysdate
        )
    </insert>

I am getting the follow exception from DB

com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the insertDonorInfo-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ORA-01400: cannot insert NULL into ("xxxx"."D
ONOR"."DONOR_ID")

The ibatis log for statements

{pstm-100010} PreparedStatement:           SELECT
to_char(FN_GETDONORID) AS "strDonorID" FROM DUAL
{pstm-100010} Parameters: []
{pstm-100010} Types: []
{rset-100011} ResultSet
{rset-100011} Header: [strDonorID]
{rset-100011} Result: [200500000005]
{pstm-100012} PreparedStatement:                  INSERT INTO DONOR (
DONOR_ID,    CATEGORY, CREATED_BY         , DATE_CREATED         )   
    VALUES (         ?,         ?       ,?         ,sysdate         )
{pstm-100012} Parameters: [, I,  ADMIN]
{pstm-100012} Types: [java.lang.String, java.lang.String, java.lang.String]
Returned connection 20980795 to pool.
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the insertDonorInfo-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ORA-01400: cannot insert NULL into ("XXXX"."D
ONOR"."DONOR_ID")

Please help me to solve it. Thanks in advance.

Regards
p.karthi




This e-mail and any attachment is for authorised use by the intended recipient(s) only. It
may contain proprietary material, confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any other party. If you are not
an intended recipient then please promptly delete this e-mail and any attachment and all copies
and inform the sender. Thank you.

Mime
View raw message