Idea_mybatis_sqlexception:parameter index out of range pit

Source: Internet
Author: User

Error message: exceeds the specified length of the Database data table setting

Nested exception is org.apache.ibatis.type.TypeException:Could no set parameters for mapping:parametermapping{ Property= ' apply_id ', mode=in, Javatype=class java.lang.Object, Jdbctype=bigint, numericscale=null, resultmapid= ' null ', jdbctypename= ' null ', expression= ' null '}. Cause:org.apache.ibatis.type.TypeException:Error setting non null for parameter #2 with Jdbctype BIGINT. Try setting a different jdbctype for this parameter or a different the configuration property. Cause:org.apache.ibatis.type.TypeException:Error setting non null for parameter #2 with Jdbctype BIGINT. Try setting a different jdbctype for this parameter or a different the configuration property. Cause:java.sql.SQLException:Parameter index out of range (2 > number of parameters, which is 1

The solution on the Internet is probably as follows:

This is because the number of placeholders is not equal to the number of parameters set, check the SQL you wrote and the parameters passed.

What happens to a particular write like statement:

When writing a like statement, the use of the resulting;

Write in MyBatis is supposed to be like '%${name} % ' instead of '%#{name} % '

Note:${name} is not enclosed in single quotes, and #{name} is a single quote

If it is not: it may be the reason for the comment-this is my pit, the main idea is also displayed so that no error, Pit Dad! A long memory!

Because the comment adds the wrong position!!

Idea_mybatis_sqlexception:parameter index out of range pit

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.