我的查询的语句:
@Query(value = "select u.balance from User u where u.name=:name")
float toGetBalance(@Param("name") String name);
我的service
接口
boolean checkBalance(String userName, float totalPrice);
实现
@Transactional(readOnly = true)
@Override
public boolean checkBalance(String userName, float totalPrice) {
if (userRepository.toGetBalance(userName) < totalPrice) {
return false;
} else {
return true;
}
}
然后,在运行的时候,出错了:
org.springframework.aop.AopInvocationException: Null return value from advice does not match primitive return type for: public abstract float com.repository.UserRepository.toGetBalance(java.lang.String)
我返回的值不匹配什么地,到底哪里不匹配??
balance的类型是float啊!!
哪里错了?