[ばね]org.hibernate.QueryException: could not resolve property


org.hibernate.QueryException: could not resolve property: ex_type of: com.planet.develop.Entity.ExpenditureDetail
エラーの原因
クエリー文を作成する場合は、データベースではなくJPAで生成されたフィールド名を入力します.
    /** 카테고리/친(반)환경 태그 별 태그 개수 구하기*/
    public Long getCategoryTagCount(User user, LocalDate startDate, LocalDate endDate, money_Type type,EcoEnum eco){
        return em.createQuery("select count(*) from Expenditure e " +
                        "left join ExpenditureDetail ed on e.eno = ed.eno " +
                        "left join Eco ec on e.eno = ec.expenditure.eno " +
                        "where e.user = :user and ec.eco = :eco and :startDate<=e.date and e.date <= :endDate and ed.ex_type = :type", Long.class)
                .setParameter("user", user)
                .setParameter("startDate", startDate)
                .setParameter("endDate", endDate)
                .setParameter("eco",eco)
                .setParameter("type",type)
                .getSingleResult();
    }
次のコードはmony TypeのフィールドをexTypeと名付けます.
したがって、typeではなくed.ex type=:を使用する必要があります.
public class ExpenditureDetail {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long eno;

    @Enumerated(EnumType.STRING)
    @Column(name = "ex_way")
    private money_Way exWay;

    @Enumerated(EnumType.STRING)
    @Column(name = "ex_type")
    private money_Type exType;

    private String memo;

    public void update(money_Type type, money_Way way, String memo) {
        this.exType = type;
        this.exWay = way;
        this.memo = memo;
    }

}