[Framework] ---- Mybatis resultType problem Mybatis kinds of insert or update

Attribute "resultType" must be declared for element type "insert"或"update"

insert error

The error log says Attribute "resultType" must be declared for element type "insert", there is a error message is Attribute "resultType" must be declared for element type "update"

At that time there has not found a problem, the problem is I always thought writing insert and update statements are not written resultType, it was discovered that the problem is precisely here.

Because in insert and update statements are not resultType, the information given is not to say that there is no written resultType, but then they have to say in a statement resultType mybatis file before you can use resultType.

At the beginning of the xml file generally have two lines of code:

DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"

Copy http://mybatis.org/dtd/mybatis-3-mapper.dtd into your browser, it will automatically download the dtd file, open, update and insert search and select, the distinction between will find:

select the following statement:

ATTLIST selectid CDATA #REQUIREDparameterMap CDATA #IMPLIEDparameterType CDATA #IMPLIEDresultMap CDATA #IMPLIEDresultType CDATA #IMPLIEDresultSetType (FORWARD_ONLY | SCROLL_INSENSITIVE | SCROLL_SENSITIVE) #IMPLIEDstatementType (STATEMENT|PREPARED|CALLABLE) #IMPLIEDfetchSize CDATA #IMPLIEDtimeout CDATA #IMPLIEDflushCache (true|false) #IMPLIEDuseCache (true|false) #IMPLIEDdatabaseId CDATA #IMPLIEDlang CDATA #IMPLIEDresultOrdered (true|false) #IMPLIEDresultSets CDATA #IMPLIED 

 

insert the following statement:

ATTLIST insertid CDATA #REQUIREDparameterMap CDATA #IMPLIEDparameterType CDATA #IMPLIEDtimeout CDATA #IMPLIEDflushCache (true|false) #IMPLIEDstatementType (STATEMENT|PREPARED|CALLABLE) #IMPLIEDkeyProperty CDATA #IMPLIEDuseGeneratedKeys (true|false) #IMPLIEDkeyColumn CDATA #IMPLIEDdatabaseId CDATA #IMPLIEDlang CDATA #IMPLIED

 

update the following statement:

ATTLIST updateid CDATA #REQUIREDparameterMap CDATA #IMPLIEDparameterType CDATA #IMPLIEDtimeout CDATA #IMPLIEDflushCache (true|false) #IMPLIEDstatementType (STATEMENT|PREPARED|CALLABLE) #IMPLIEDkeyProperty CDATA #IMPLIEDuseGeneratedKeys (true|false) #IMPLIEDkeyColumn CDATA #IMPLIEDdatabaseId CDATA #IMPLIEDlang CDATA #IMPLIED

 

As can be seen in select statement has resultType, and update and insert resultType no
error here.

Guess you like

Origin blog.csdn.net/ningjiebing/article/details/89411057