org.hibernate.QueryException: could not resolve property:

  项目一直报这个错误,网上也搜了很多相关的,有的说 hql 查询语句和 实体类没有对应起来,可是我的都对应了,还是不知道问题在哪。上代码

  

    public List<Survey> findMySurveys(User user) {
        String hql = "from Survey s join s.user u where u.id = ?" ;
        List<Survey> list = surveyDao.findEntityByHql(hql, user.getId()) ;
        return list ;
    }

对应的 hbm.xml:

 <many-to-one name="uesr" class="com.ysp.surveypark.model.User">
            <column name="UESR_ID" />
 </many-to-one>

实体类(set\get方法略):

public class Survey {
    private Integer id ;
    private String title = "未命名" ;
    private String preText = "上一步" ;
    private String nextText = "下一步" ;
    private String exitText = "退出" ;
    private String doneText = "完成" ;
    //创建时间
    private Date createTime = new Date() ;
    //创建 Survey-User n-1 的关联关系
    private User uesr ;
    //创建 Survey-Page 1-n 的关联关系
    private Set<Page> pages = new HashSet<Page>() ;
}

有谁知道错在哪嘛,实在没办法了

posted @ 2015-01-18 00:33  苏陌Bubble  阅读(263)  评论(0编辑  收藏  举报