org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.

简介: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.



报错原因

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'productlis' in 'class com.wy.po.Orders'
### The error may exist in com/wy/mapper/Orders.xml
### The error may involve com.wy.mapper.Orders.findOrdersWithProduct2
### The error occurred while handling results
### SQL: SELECT o.*,p.id as pid,p.name,p.price            from tb_orders o,tb_product p,tb_ordersitem oi            WHERE oi.orders_id=o.id            and oi.product_id=p.id            and o.id=?
### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'productlis' in 'class com.wy.po.Orders'
    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.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
    at com.wy.test.MybatisAssociatedTest.findOrdersTest1(MybatisAssociatedTest.java:95)
    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.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:89)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'productlis' in 'class com.wy.po.Orders'
    at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:422)
    at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:164)
    at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:162)
    at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49)
    at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.instantiateCollectionPropertyIfAppropriate(DefaultResultSetHandler.java:1079)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyNestedResultMappings(DefaultResultSetHandler.java:911)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:868)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForNestedResultMap(DefaultResultSetHandler.java:831)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:315)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:290)
    at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:187)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
    at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
    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)
    ... 26 more

解决:拼写错误

property中少打了个字母

<collection property="productlis" ofType="Product">
                <id property="id" column="pid"/>
                <result property="name" column="name"/>
                <result property="price" column="price"/>
              </collection>

       

<collection property="productlist" ofType="Product">
                <id property="id" column="pid"/>
                <result property="name" column="name"/>
                <result property="price" column="price"/>
              </collection>


相关文章
|
1月前
|
Java 数据库连接 mybatis
解决Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: No constructor found
解决Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: No constructor found
87 1
|
6月前
|
Java
【Java异常】Error:(30, 62) java: 程序包com.sun.org.apache.xerces.internal.impl.dv.util不存在
【Java异常】Error:(30, 62) java: 程序包com.sun.org.apache.xerces.internal.impl.dv.util不存在
556 0
|
2月前
|
关系型数据库 数据库 PostgreSQL
wikijs在启动项目时遇到的问题Database Initialization Error: create table “migrations“
wikijs在启动项目时遇到的问题Database Initialization Error: create table “migrations“
|
4月前
|
SQL 分布式计算 资源调度
[已解决]FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. Unable to
[已解决]FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. Unable to
129 0
|
4月前
|
SQL 分布式计算 Hadoop
【已解决[ERROR] Could not execute SQL statement. Reason:java.lang.ClassNotFoundException: org.apache.had
【已解决[ERROR] Could not execute SQL statement. Reason:java.lang.ClassNotFoundException: org.apache.had
86 0
|
4月前
|
XML Java 数据库
SpringBoot【问题 03】BindingException\MalformedInputException\Error querying database(sqlite数据库)
SpringBoot【问题 03】BindingException\MalformedInputException\Error querying database(sqlite数据库)
63 0
|
6月前
|
缓存 Java 编译器
【Java异常】Error:(19, 21) java: 无法访问org.apache.poi.xwpf.usermodel.ParagraphAlignment 找不到org.apache.po
【Java异常】Error:(19, 21) java: 无法访问org.apache.poi.xwpf.usermodel.ParagraphAlignment 找不到org.apache.po
142 0
|
6月前
|
XML Java 数据库连接
MyBatis参数映射问题解决教程: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 wit
MyBatis参数映射问题解决教程: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 wit
318 1
|
8月前
|
Java 数据库连接 数据库
org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.问题的解决
org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.问题的解决
|
8月前
|
关系型数据库 MySQL 数据库
【报错】DVWA遇到Could not connect to the database service. Please check the config file. Database Error
【报错】DVWA遇到Could not connect to the database service. Please check the config file. Database Error
533 0

热门文章

最新文章

推荐镜像

更多