日期:2014-05-19  浏览次数:20804 次

ibatis配置selectKey报错!!
XML code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap      
    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"      
    "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap>
<!-- 取别名 -->
    <typeAlias alias="user" type="com.broada.coss.usermamt.entity.User"/>

    <select id="findAllUser" resultClass="user">
        <![CDATA[ select * from t_user ]]>
    </select>
    <select id="findUserById" parameterClass="int" resultClass="user">
        select * from t_user where id=#id#
    </select>
    <insert id="insertUser" parameterClass="user">
        <selectKey keyProperty="id" resultClass="int" type="pre">
             <![CDATA[
             SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
             ]]>
        </selectKey>
        <![CDATA[
            insert into t_user(id,name,birthday,address,salary) values(#id#,#name#,#birthday#,#address#,#salary#)
        ]]>
    </insert>
    <update id="updateUser" parameterClass="user">
        update t_user set name=#name#,birthday=#birthday#,address=#address#,salary=#salary# where id=#id#
    </update>
    <delete id="deleteUser" parameterClass="int">
        delete from t_user where id=#id#
    </delete>
</sqlMap>






报的错误是 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowNo' defined in class path resource [test-appContext-common.xml]: Cannot create inner bean 'com.broada.itil.common.flowno.dao.ibatis.IbatisFlowNoDao#1fcf0ce' of type [com.broada.itil.common.flowno.dao.ibatis.IbatisFlowNoDao] while setting bean property 'flowNoDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.broada.itil.common.flowno.dao.ibatis.IbatisFlowNoDao#1fcf0ce' defined in class path resource [test-appContext-common.xml]: Cannot resolve reference to bean 'sqlMapClient' while setting bean property 'sqlMapClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [test-daoContext-common.xml]: Invocation of init method failed; nested exception is com.ibatis.common.exception.NestedRuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: Element type "select" must be declared.
Caused by: org.xml.sax.SAXParseException: Element type "select" must be declared.
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXPars