Org.mybatis.spring.MyBatisSystemException Solutions for Springboot+mybatis

Source: Internet
Author: User

"Nested exception is org.apache.ibatis.exceptions.PersistenceException: \r\n### Error querying database. cause:java.lang.unsupportedoperationexception\r\n### the error exist in Com/hiteamtech/uws/dao/appsdao.java Guess) \r\n### the error involve com.hiteamtech.uws.dao.appsdao.findappinfobyuserid\r\n### the error occurred while Handling results\r\n### Sql:select id,app_name,create_time,app_introduction,user_id from app_info where status = 1 and US er_id =? Order BY ID limit?,? \r\n### Cause:java.lang.UnsupportedOperationException "

Here is the code for my DAO layer

and controller Layer Code

@Select ("Select id,app_name,create_time,app_introduction,user_id from app_info where status = 1 and user_id =#{userid} or Der by ID limit #{page},#{pagecount} ")
List Findappinfobyuserid (@Param ("userid") int userId, @Param ("page") int Page1, @Param ("PageCount") int pagecount) ;



@GetMapping (value = "/apps/{userid}/{page}/{pagecount}")
Public responseentity<map> Findappsbyuserid (@PathVariable ("userid") int userId, @PathVariable ("page") int page, @PathVariable ("PageCount") int pagecount,map<string,object> Map) {
Log.debug ("Get my product based on user id:" + userId + "page:" + page+ "PageCount:" + PageCount);
Map.put ("Appcount", Iappservice.findappscount (userId));
Map.put ("AppInfo", Iappservice.findappsbyuserid (Userid,page,pagecount));
return new responseentity<> (Map,httpstatus.ok);
}


Because the JSON data returned in the controller is a map, you cannot return to DAO with list

The following modifications can be made to DAO

@Select ("Select id,app_name,create_time,app_introduction,user_id from app_info where status = 1 and user_id =#{userid} or Der by ID limit #{page},#{pagecount} ")
List<map<string,object>> Findappinfobyuserid (@Param ("userid") int userId, @Param ("page") int Page1, @Param ("PageCount") int pagecount);

Org.mybatis.spring.MyBatisSystemException Solutions for Springboot+mybatis

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.