• mybatis 错误


    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 3
    	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
    	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
    	at com.sun.proxy.$Proxy96.selectOne(Unknown Source)
    	at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166)
    	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82)
    	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
    	at com.sun.proxy.$Proxy172.getFeedbackStatistics(Unknown Source)
    	at com.wangtiansoft.ke.modules.apis.feedback.service.impl.FeedbackMobileServiceImpl.getFeedbackCountByclass(FeedbackMobileServiceImpl.java:40)
    	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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    

      

    这个错误的原因就是因为你的查询方法中得到多个结果集,然而你的返回用了一个实体去接收,程序这个时候就不知道如何去分配了,很果断的报这个错,

    修改方法为使用一个list来接收就没有问题了。

  • 相关阅读:
    解决 minwidth 在 IE6 中无效的方法
    SmallSlider 图片轮播插件
    css li中a的高端与li的高端不一致,解决方案
    为什么height:5px在IE6里显示不正常?
    命令提示符下不能输入中文
    Sql中日期差 Sql中 DateDiff Sql 中时间差
    20100420 18:17 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters
    多个表结果的并列显示
    linux系统下载地址
    VMware中Shared Folders(共享文件夹)的配置
  • 原文地址:https://www.cnblogs.com/lixxx/p/10721794.html
Copyright © 2020-2023  润新知