background
JDK Version: 1.8
Framework: SpringBoot 2.x
ORM: JPA
abnormal
All exception information is not posted, too, the key to this one below
java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.lang.Integer com.ess.fsjs.useWaterPlan.dao.PlanTotalIndicatorsDao.queryMaxPlanYear()!
From this point of view exception information, suggesting relatively pan, just say for verification fails, there are several errors that may occur will this prompt.
Find concrete error method, namely: com.ess.fsjs.useWaterPlan.dao.PlanTotalIndicatorsDao.queryMaxPlanYear (), facie Code:
/ ** * Query has the largest amount of planned targets of the year * @return * / @Query (value = "the SELECT max (plan_year) from t_plan_total_indicators" ) Integer queryMaxPlanYear ();
A very simple query using native SQL, SQL can be seen that there is no problem. JPA when using native SQL statements, you need nativeQuery = true, so the problem lies here, plus enough.
The revised Code:
/ ** * Query has the largest amount of planned targets of the year * @return * / @Query (value = "the SELECT max (plan_year) from t_plan_total_indicators", nativeQuery = to true ) Integer queryMaxPlanYear ();