"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