Aggregate function with spring data
I was working on a small project. Requirement was different in term of object mapping. There is simple way to map java object with database table. Aggregate function in query is not mapped with entity class. We don't have direct mapping attribute in JPA annotation to map aggregate function with entity class. Spring data support this using interface. In ORM query we use aggregate function e.g. count , sum etc. the output of these aggregate function cannot directly map with the Entity class. To collect the outcome of aggregate methods. We need to map using interface in java and provide the Interface class with mapping method. public List<ITeacherReport> getTeacherReport(String teacherName); Our requirement is to count solved question per month by teacher from answer table. We have below environment configuration. Thymeleaf (for view, this is template engine) JDK 1.8 Maven Springboot framework MySql for database operation Open the start....