问题一
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘custController’: Unsatisfied dependency expressed through field ‘customerRepository’;
解决方法:
在使用@Query
注解自定义sql语句时,要在后面加上nativeQuery=true
,如下就能正常执行。原生sql如果不加上nativeQuery = true
,就会按照默认hql处理。
//查询id 的值最大的那个 customer
@Query(value = "select * from cst_customer c where c.cust_id = (select max(c2.cust_id) from cst_c