[ばね]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;
}
}
Reference
この問題について([ばね]org.hibernate.QueryException: could not resolve property), 我々は、より多くの情報をここで見つけました https://velog.io/@code12/스프링org.hibernate.QueryException-could-not-resolve-propertyテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol