jeudi 9 juillet 2015

Repository hibernate Query for group by?

I have @Repository

@Repository
public interface AccessLogRepository extends JpaRepository<AccessLogModel, String>,JpaSpecificationExecutor<AccessLogModel> { 

@Modifying
@Query("select CAST(al.access_date AS DATE) as datum, meal_type ,    count(meal_type) from access_log al GROUP BY  CAST(al.access_date AS DATE) ,    meal_type")
List<ReportModel> getReports() ;

}

I work with CRUD query but this some special , can someone give me idea why is not working and what i need to do ? Query is good , but I can't execute from java program .

Aucun commentaire:

Enregistrer un commentaire