-1

我有两个模型类 UserDetail 和 TempDataDetail 我在我的 UserDetails 模型类中创建了 TempDataDetails 的对象tempDataDetails ,在 TempdataDetails 中创建了相同的 UserDetails 的userDetails

我的加入 hql 查询是“来自 UserDetails userDetailsjoin userDetails.TempdataDetails tempDataDetails where userDetails.snrno = tempDataDetails.snrno ”,并且在执行此查询时导致错误: TempdataDetails could not resolve the property

我已将查询更改为:

我的加入 hql 查询是“来自 TempdataDetails tempDataDetails join tempDataDetails.UserDetails userDetailswhere tempDataDetails.snrno = userDetails.snrno ”,并且在执行此查询时会导致错误: UserDetails could not resolve the property

我的 getter() setter() 是:


public class UserDetails{

    @OneToOne
    @PrimaryKeyJoinColumn
    private TempDataDetails tempDataDetails;

    public TempDataDetails getTempDataDetails() {
        return tempDataDetails;
    }

    public void setTempDataDetails(TempDataDetails tempDataDetails) {
        this.tempDataDetails = tempDataDetails;
    }
}

public class TempDataDetails{

    @OneToOne(mappedBy = "tempDataDetails", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    private UserDetails userDetails;

    public UserDetails getUserDetails() {
        return userDetails;
    }

    public void setUserDetails(UserDetails userDetails) {
        this.userDetails = userDetails;
    }
}
4

1 回答 1

0

Java 区分大小写。这些字段被命名为tempDataDetailsand userDetails,而不是TempdataDetailsand UserDetails

于 2013-07-09T08:38:28.647 回答