0

道类

@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);

控制台上的查询异常

` org.hibernate.QueryException: 无法解析属性: userPaymentTransaction of: com.ctpm.rrh.basket.model.user.User [从 com.ctpm.rrh.basket.model.user.User 中选择 pt 作为你的内部加入你.userPaymentTransaction as pt where 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;

请帮忙

4

1 回答 1

0

我认为您的查询应该是这样的:-

@Query("select pt from UserPaymentTransaction pt where pt.owningUser = ?1")
于 2013-10-01T06:23:17.810 回答