首页 > Web开发 > 详细

org.hibernate.QueryException: could not resolve property:

时间:2015-01-18 00:48:24      阅读:911      评论:0      收藏:0      [点我收藏+]

  项目一直报这个错误,网上也搜了很多相关的,有的说 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>() ;
}

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

org.hibernate.QueryException: could not resolve property:

原文:http://www.cnblogs.com/alwaysjava/p/4231358.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!