<?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.SAXParseException: Element type "select" must be declared.
Caused by: org.xml.sax.SAXParseException: Element type "select" must be declared.
Caused by: 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.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: 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.SAXParseException: Element type "select" must be declared.
Caused by: org.xml.sax.SAXParseException: Element type "select" must be declared.
Caused by: 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.SAXParseException: Element type "select" must be declared.
Caused by: org.xml.sax.SAXParseException: Element type "select" must be declared.
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'versionDao' defined in class path resource [test-daoContext-common.xml]: Unsatisfied dependency expressed through constructor argument with index 1 of type [boolean]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'versionManager' defined in class path resource [test-daoContext-common.xml]: Unsatisfied dependency expressed through constructor argument with index 5 of type [java.lang.String]: Could not convert constructor argument value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]: Failed to convert value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]: no matching editors or conversion strategy found
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'versionManager' defined in class path resource [test-daoContext-common.xml]: Unsatisfied dependency expressed through constructor argument with index 5 of type [java.lang.String]: Could not convert constructor argument value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]: Failed to convert value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]: no matching editors or conversion strategy found
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'versionDao' defined in class path resource [test-daoContext-common.xml]: Unsatisfied dependency expressed through constructor argument with index 1 of type [boolean]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'versionManager' defined in class path resource [test-daoContext-common.xml]: Unsatisfied dependency expressed through constructor argument with index 5 of type [java.lang.String]: Could not convert constructor argument value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]: Failed to convert value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]: no matching editors or conversion strategy found
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'versionManager' defined in class path resource [test-daoContext-common.xml]: Unsatisfied dependency expressed through constructor argument with index 5 of type [java.lang.String]: Could not convert constructor argument value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]: Failed to convert value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy] to required type [java.lang.String]: no matching editors or conversion strategy found

解决方案 »

  1.   

    如果把
    <selectKey keyProperty="id" resultClass="int" type="pre">
       <![CDATA[
        SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
      ]]>
    </selectKey>
    这一句删除掉就不会报错 为什么啊 ~~!!!!!!! 菜鸟求真相
      

  2.   


    <insert id="insertUser" parameterClass="user"
            <![CDATA[
                insert into t_user(id,name,birthday,address,salary) values( STOCKIDSEQUENCE.NEXTVAL ,#name#,#birthday#,#address#,#salary#)
            ]]>
        </insert>昨天研究了一下,改成这个样子就OK 了
    但是还是不知道为什么。.... 这个问题还得自己结..