ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Musgrove" <JMusgr...@fcci-group.com>
Subject Oracle <selectKey> execution issue
Date Fri, 24 Feb 2006 15:16:40 GMT
Again, newbie to Ibatis.

I am trying to leverage the <selectKey> functionality with Oracle.  It
appears that the <selectKey> is not executing before the insert
therefore I am getting:

"java.sql.SQLException: ORA-01400: cannot insert NULL into
("ODS"."ENTITY_SRC"."ENT_SRC_ID")"

I searched a number of post and found nothing similar to this problem.
Although, the online documentation states to add type="pre"
(http://opensource2.atlassian.com/confluence/oss/pages/viewpage.action?p
ageId=407) to get the sequence before execution of the insert statement.


When this is added the following occurs (it isn't defined in dtd):
 Attribute "type" must be declared for element type "selectKey".

If anyone could help assist it would be much appreciated. I have a
feeling it maybe something "stupid".

Thanks in advance.

Code snippet:

  <insert id="insertEntity"
parameterClass="com.x.ods.domain.entity.Entity"> 
    <selectKey resultClass="java.lang.Integer" keyProperty="entSrcId">
       	SELECT ODS.ENT_SRC_ID_SEQ.NEXTVAL as entSrcId FROM DUAL
    </selectKey>  
    insert into ODS.ENTITY_SRC (ENT_SRC_ID, SRC_SYSTEM, SRC_ENT_NUM) 
    values (#entSrcId:DECIMAL#, #srcSystem:VARCHAR#,
#srcEntNum:VARCHAR#)
    
  </insert>

Mime
View raw message