ibatis 返回主键问题
我的配置如下
<insert id="insertTblqybsinfo"
parameterClass="com.icinfo.busadm.hx.formbean.TblqybsinfoBean">
<![CDATA[
<selectKey resultClass="int" keyProperty="bsid" >
SELECT TBLQYBSINFO_SEQ.NEXTVAL AS bsid FROM DUAL
</selectKey>
INSERT INTO tblqybsinfo
( userid,
bsurl,
bsid,
bsname)
VALUES
( #userid#,
#bsurl#,
#bsid#,
#bsname)]]>
</insert>
报错如下:
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in Xml/Tblqybsinfo.xml.
--- The error occurred while applying a parameter map.
--- Check the insertTblqybsinfo-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ORA-00900: 无效 SQL 语句
Caused by: java.sql.SQLException: ORA-00900: 无效 SQL 语句
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:446)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:60)
at com.icinfo.busadm.hx.dao.TblqybsinfoDao.CreateTblqybsinfo(TblqybsinfoDao.java:73)
以上配置我去掉 <selectKey>标记将#bsid#换成TBLQYBSINFO_SEQ.NEXTVAL ,直接插入是没有问题的。
请大家帮我看看