Ibaits, about the Insert return value (NOTE!!! Do not have to write resultclass= "Java.lang.Integer", the return value of the method is int)

Source: Internet
Author: User

Today work using ibaits write SQL, one of which is insert statement



That's what I wrote in Sqlmap, <insert.

Parameterclass= "..."

resultclass= "Java.lang.Integer" >


The following error was reported:

Org.xml.sax.SAXParseException:Attribute "ResultClass" must is declared for element type "insert".


first of all , do not say my mistake, mainly this error message, checked on the Internet, there are problems.


the correct error message should be:

Org.xml.sax.SAXParseException:Attribute "ResultClass" must is declared for element type "insert".

then analyze the cause of the error:

Two ways we all know about statement in JDBC

ResultSet ExecuteQuery (String SQL)
Executes the given SQL statement, which returns a single ResultSet object.
Int executeupdate (String SQL)
Executes the given SQL statement, which May is an INSERT, UPDATE, or DELETE statement or a SQL statement that returns n Othing, such as an SQL DDL statement.

These two methods, where the result set is our general definition of Sqlid001output.java, but as the number of updates or inserts, is the system automatically returned, so we do not need to set, in the Ibaits Executeforupdate method return value is int, If we write back the value in the Sqlmap, it is the superfluous, and it also gives you the wrong message which is very confusing to you.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.