Dao班
@Query("select pt from com.ctpm.rrh.basket.model.user.User as u inner join u.userPaymentTransaction as pt where u = ?")
List<UserPaymentTransaction> findPaymentTransactionforUser(User user);
控制台上的QueryException
`org.hibernate.QueryException:无法解析属性:userPaymentTransaction:com.ctpm.rrh.basket.model.user.User [从com.ctpm.rrh.basket.model.user.User中选择pt为你内部联接u.userPaymentTransaction为pt,其中u =?]
UserPaymentTransaction类有
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private Money amount;
private String description;
@NotNull
@OneToOne(cascade = CascadeType.MERGE)
User owningUser;
private Date transactionDate;
请帮忙
答案 0 :(得分:0)
我认为您的查询应该是这样的: -
@Query("select pt from UserPaymentTransaction pt where pt.owningUser = ?1")