Based in the thread: Spring Data JPA - Custom Query with multiple aggregate functions in result
I have this query in my jpa repository
@Query("SELECT new mx.com.sk.AveragesPojo(AVG(a.initial), AVG(a.initialEFSL), AVG(a.finalEFSL), AVG(a.entitySettlement)) FROM AveragesModel AS a WHERE groupName = :groupName AND idRemote = :idRemote")
public AverajesPojo getLastSurveyAverages(@Param("groupName") String groupName, @Param("idRemote") Long idRemote);
}
And in my pojo constructor is:
public AverajesPojo(Float initial, Float initialEFSL, Float entitySettlement, Float finalEFSL) {
super();
this.initial = initial;
this.initialEFSL = initialEFSL;
this.entitySettlement = entitySettlement;
this.finalEFSL = finalEFSL;
}
But I have this error:
Error creating bean with name 'averagesRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract mx.com.sk.pojos.AverajesPojo mx.com.sk.admin.repositories.AveragesRepository.getLastSurveyAverages(java.lang.String,java.lang.Long)!
what's my error?