日期:2014-05-17  浏览次数:20647 次

ibatis 报语法错误
SQL code


PROCEDURE [dbo].[d_dir_lists_Delete]
@node_id int
as
DELETE [d_dir_lists] WHERE node_id =@node_id

--exec d_dir_lists_Delete 111持行没有问题 数据库为sqlserver2005




Java code

//java代码
Map<String,Integer> map =new HashMap<String, Integer>();
map.put("node_id", new Integer(node));

this.getSqlMapClientTemplate().queryForObject("proTree.delRootNode",map);



XML code

//sqlMap
        <parameterMap id="inParameters" class="java.util.Map">
            <parameter property="node_id" jdbcType="INTEGER" javaType="java.lang.Integer" mode="IN" />
        </parameterMap>
        <!-- 调用存储过程,根据根节点id删除,以及它一下的所有节点 -->
        <procedure id="delRootNode" parameterMap="inParameters">
          <![CDATA[{call d_dir_lists_Delete (?) }]]>
       </procedure>



这个会报错 妹的,到底那里出错了?

org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in config/ProTree.xml.
--- The error occurred while applying a parameter map.
--- Check the proTree.inParameters.
--- Check the statement (update procedure failed).
--- Cause: com.microsoft.sqlserver.jdbc.SQLServerException: ' ' 附近有语法错误。

------解决方案--------------------
call d_dir_lists_Delete (?) 
直接放到DB里面可以执行么?