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