首页 > 网站 > 帮助中心 > 正文

mybaits非配置原因,导致SqlSession was not registered for syn

2024-07-09 22:40:45
字体:
来源:转载
供稿:网友

今天运行程序时报了

SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@69d4fb43] was not registered for synchronization because synchronization is not active

[11:03:17]-Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@69d4fb43]

由于异常是集中处理的,所以报了这样的错误,查了半天,网上结果都是说配置文件出错的,可是我的项目配置文件肯定是没错的,因为项目都开发了好长时间了,只是我今天写了个方法才报的这个错误,所以排除配置文件出错,可是我写的方法应该没问题的,以前也这样写的呀。

      网上查半天没找到原因,没办法,只能看看自己的程序了,把自己写的方法异常直接打印出来,先不集中处理,然后异常出来了:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘departid‘ in ‘class java.lang.String‘

 at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)

 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)

 at com.sun.proxy.$Proxy15.selectOne(Unknown Source)

 at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)

 at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68)

 at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)

 at com.sun.proxy.$Proxy125.selectCount(Unknown Source)

 at com.sinog2c.service.impl.yzgl.TbyzScoreServiceImpl.selectCount(TbyzScoreServiceImpl.java:66)

 at com.sinog2c.mvc.controller.yzgl.criminalexam.JifenController.getLastMonthScoreList(JifenController.java:76)

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

 at java.lang.reflect.Method.invoke(Method.java:597)

 at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175)

 at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446)

 at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)

 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)

 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)

 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)

 at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

 at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表