mybatis Error querying database. Cause: org.apache.ibatis.type.TypeException: Could not set paramet
来源:互联网 发布:湖州美工培训学校 编辑:程序博客网 时间:2024/06/14 09:07
错误:
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='userCustom.username1', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:2,栏位数:1。### The error may exist in mybatis/mapper/UserMapper.xml
### The error may involve mybatis.mapper.UserMapper.findUserList-Inline
### The error occurred while setting parameters
### SQL: SELECT * FROM "user" where "user".sex=? and "user".username1 like '%?%'
### Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='userCustom.username1', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:2,栏位数:1。
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy5.findUserList(Unknown Source)
at mybatis.mapper.UserMapperTest.testFindUserList(UserMapperTest.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='userCustom.username1', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:2,栏位数:1。
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:89)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:93)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:64)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
... 30 more
Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:2,栏位数:1。
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:55)
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:87)
... 39 more
Caused by: org.postgresql.util.PSQLException: 栏位索引超过许可范围:2,栏位数:1。
at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:65)
at org.postgresql.core.v3.SimpleParameterList.setStringParameter(SimpleParameterList.java:128)
at org.postgresql.jdbc.PgPreparedStatement.bindString(PgPreparedStatement.java:1029)
at org.postgresql.jdbc.PgPreparedStatement.setString(PgPreparedStatement.java:369)
at org.postgresql.jdbc.PgPreparedStatement.setString(PgPreparedStatement.java:353)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:67)
at com.sun.proxy.$Proxy7.setString(Unknown Source)
at org.apache.ibatis.type.StringTypeHandler.setNonNullParameter(StringTypeHandler.java:31)
at org.apache.ibatis.type.StringTypeHandler.setNonNullParameter(StringTypeHandler.java:26)
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:53)
... 40 more
原因:
因为图中用的是#{},改成${}就不会报错了,在详细的原因我也不清楚
阅读全文
0 0
- mybatis Error querying database. Cause: org.apache.ibatis.type.TypeException: Could not set paramet
- Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Types'
- org.apache.ibatis.type.TypeException: Could not resolve type alias
- Mybatis使用之 Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias‘User’
- org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.apache.
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'BaseResultMap'
- org.apache.ibatis.type.TypeException: Could not resolve type alias异常
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'BaseResultMap‘
- 【笔记】org.apache.ibatis.type.TypeException: Could not resolve type alias 'tableMapToModel'.
- org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'.
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Student'
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'BaseResultMap'
- Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'BaseResultMap'
- org.apache.ibatis.type.TypeException: Could not resolve type alias 'id'.
- 遇到org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.sql.
- Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could no
- Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'schedu
- FAQ(17):Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'addressDesc
- 121. Best Time to Buy and Sell Stock
- shell 概述
- UIViewContentMode详解
- More Effective C++之Item M11:禁止异常信息(exceptions)传递到析构函数外
- uniq
- mybatis Error querying database. Cause: org.apache.ibatis.type.TypeException: Could not set paramet
- 新技术
- 【POJ2001】Shortest Prefixes
- JS学习(13)----eventlistener
- RAID介绍
- 分解质因数(5分)
- MyBatis错题分析
- HDU-5961 传递(暴力)
- springMVC 请求404错误或静态资源无法访问