异常:
java.sql.SQLException: Select statements cannot be executed as an update. at com.ibatis.sqlmap.engine.mapping.statement.SelectStatement.executeUpdate(SelectStatement.java:31) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:59) at com.ecp.ibatis.main.Test.addPerson(Test.java:46) at com.ecp.ibatis.main.Test.main(Test.java:60) Exception in thread "main"
person_SqlMap.xml
<?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 namespace="Person"> <resultMap id="person" class="com.ecp.ibatis.java.Person"> <!-- WARNING - This element is automatically generated by Abator for iBATIS, do not modify. This element was generated on Fri Mar 20 15:38:16 CST 2009. --> <result column="PER_ID" property="perId" jdbcType="NUMERIC"/> <result column="PER_FIRSTNAME" property="perFirstname" jdbcType="VARCHAR"/> <result column="PER_LASTNAME" property="perLastname" jdbcType="VARCHAR"/> <result column="PER_BIRTHDAY" property="perBirthday" jdbcType="TIMESTAMP"/> <result column="PER_WEIGTH_KG" property="perWeigthKg" jdbcType="NUMERIC"/> <result column="PER_HEIGHT_M" property="perHeightM" jdbcType="NUMERIC"/> </resultMap> <select id="getPerson" resultMap="person" parameterClass="java.lang.Integer"> <!-- WARNING - This element is automatically generated by Abator for iBATIS, do not modify. This element was generated on Fri Mar 20 15:38:16 CST 2009. --> select PER_ID, PER_FIRSTNAME, PER_LASTNAME, PER_BIRTHDAY, PER_WEIGTH_KG, PER_HEIGHT_M from Person where PER_ID = #perId:NUMERIC# <strong></select> <span style="color: rgb(255, 0, 0);"><select id="addPerson" resultClass="java.lang.Integer" parameterClass="com.ecp.ibatis.java.Person"> insert into Person values(#perId,#perFirstname,#perLastname,#perBirthday,#perWeigthKg,#perHeightM) </select></span></strong> </sqlMap>
原因:
是因为在xml文件中,配置的文件有误码,我所要做的操作是删除数据库中一条记录。
却在配置中配置 <select>
因此产生此错误.
解决办法。把select 改成 delete.
相关推荐
JavaScript StatementsA JavaScript program is a list of statements to be executed by a computer.The value of z is 11.
5.12 The Null Value as an Expression . . . . . . . . . . . . . . . . . . . . . . 114 5.13 The Compound Scalar Expression . . . . . . . . . . . . . . . . . . . . 115 5.14 The Aggregation Function and ...
* A TLargeIntField cannot be used as a linking field in a master/detail relationship. Doing so results in the error "Cannot access field <fieldname> as type variant." * TClientDataSet doesn...
在MySQL数据库操作中,"The used SELECT statements have a different number of columns" 是一个常见的错误提示,这表明在使用UNION或UNION ALL等合并查询语句时,参与合并的各个SELECT子句返回的列数量不匹配。...
05. Retrieving Data with Select Statements 06. Control Statements 7. Data Structures and Creating Internal Tables 7a. Processing Internal Tables> 08. Online Debugging 09. Modularization ...
集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...
在MySQL数据库中,当你尝试执行一个包含`UNION`操作的SQL查询时,可能会遇到错误“ERROR 1222 (21000): The used SELECT statements have a different number of columns”。这个错误提示意味着你在`UNION`操作中...
To make use of either more or less strict isolation levels in applications, locking can be customized for an entire session by setting the isolation level of the session with the SET TRANSACTION ...
It can be executed from different places depending on the type of project. For CSharp projects it can be executed from the references node. For Visual Basic and Website projects it can be executed ...
- **Switch Statement**: The `switch` statement provides a more efficient way to select one of many code blocks to be executed. It evaluates an expression and matches it against a list of cases. If a ...
<property name="hibernate.c3p0.max_statements">50 ``` - **作用**:限制每个连接上缓存的 PreparedStatement 的最大数量。这有助于减少内存消耗。 ##### 3.6 hibernate.c3p0.idle_test_period - **含义**:...
Using SELECT Statements with an INTO Clause Section 5.3. Creating and Using Cursors Section 5.4. Using Unbounded SELECT Statements Section 5.5. Performing Dynamic SQL with Prepared Statements ...
Analog Test Statements..................................................................................... 16 Digital Testing ............................................................................
C++ (pronounced see plus plus) was developed by Bjarne Stroustrup at Bell Labs as an extension to C, starting in 1979. C++ adds many new features to the C language, and is perhaps best thought of as a...
This program expects to find a file with the name SQLStatements.txt in ... will create tables in the technical_library Access that should initially be empty, and already registered as an ODBC .
安装$ npm install --save require-statements用法var requireStatements = require ( 'require-statements' ) ;requireStatements ( ) ; // ^ Would read `./package.json` and return require statements for ...
Exploring Mapped SQL Statements . 7 A Note about Namespaces........... 8 Scope and Lifecycle .......... 9 Mapper Configuration XML 10 properties ........ 11 settings ............ 12 typeAliases...
4.4 Output as String Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.4.1 Converting Numbers to Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 ...
### mybatisMapped报错 Statements collection does not contain value for 在使用MyBatis框架进行数据库操作时,可能会遇到“Mapped Statements collection does not contain value for”这样的错误提示。这通常...