小编tec*_*ics的帖子

Spring Data JPA无法实例化类

我的代码有问题。

我粘贴在我的DAO界面下面:

public interface EventDao extends CrudRepository<Event, Integer>{
...
@Query("SELECT new com.patryk.entity.ActionStatistics(e.action.actionname,sum(e.lengthinmilis)) FROM Event e where e.user = ?1 and e.removed = 0 and year(e.createdate) = year(?2) and month(e.createdate)=month(?2) and e.action.isworkingaction = 1")
public List<ActionStatistics> findMonthlyUserStatisticsByUserAndCreateDay(User user, Date createday);
...
}
Run Code Online (Sandbox Code Playgroud)

ActionStatistics类别:

        package com.patryk.entity;

        import java.text.SimpleDateFormat;
        import java.util.Date;
        import java.util.TimeZone;

        public class ActionStatistics {

            private String actionname;
            private long time;
            private String timeString;

            public ActionStatistics() {
                this.actionname = "actionname";
                this.time = 0;
            }

            public ActionStatistics(String actionname, long time) {
                this.actionname …
Run Code Online (Sandbox Code Playgroud)

spring spring-data spring-data-jpa spring-boot

2
推荐指数
1
解决办法
3702
查看次数