今天在一个springboot 项目里面写个查询报错java.lang.UnsupportedOperationException
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.UnsupportedOperationException
### The error may exist in file [E:\clj\demo\target\classes\cn\demo\modular\system\mapper\mapping\ProductMapper.xml]
### The error may involve cn.demo.modular.system.mapper.ProductMapper.getProductList
### The error occurred while handling results
### SQL: select product_id AS productId, name, image, type, remark from sys_product where 1 = 1 order by product_id ASC
### Cause: java.lang.UnsupportedOperationException
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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mybatis.spring.SqlSessionTemplateTSqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 111 more
mapper接口返回类型是List
public interface ProductMapper extends BaseMapper<Product>{
public List<Product> getProductList();
}
xml select标签resultTyep不能用list要用实体类,错误解决。
<select id="getProductList" resultType="cn.demo.modular.system.entity.Product"><!-- resultType="java.util.List" -->
select
<include refid="Base_Column_List"/>
from sys_product where 1 = 1
order by product_id ASC
</select>