在hibernate和Spring自动生成的dao中如何根据外键来查询数据
我自己写的报错couldnotresolveproperty:yxBzjof:cn.com.yx.entity.YxBorad[fromcn.com.yx.entity....
我自己写的
报错 could not resolve property: yxBzj of: cn.com.yx.entity.YxBorad[from cn.com.yx.entity.YxInvition as model where model.yxBorad = ?];nested exception is org.hibernate.QueryException: could not resolve property: yxBzj of: cn.com.yx.entity.YxBorad [from cn.com.yx.entity.YxInvition as model where model.yxBorad = ?]
问题已经结局,在hql语句中我用字符串拼接不用预编译,同时用String queryString = "from YxInvition as model where model.yxBorad.yxBZj ="+ id;问题可以解决!当然这肯定不是最好的办法 嘿嘿!希望有更好的方法 展开
报错 could not resolve property: yxBzj of: cn.com.yx.entity.YxBorad[from cn.com.yx.entity.YxInvition as model where model.yxBorad = ?];nested exception is org.hibernate.QueryException: could not resolve property: yxBzj of: cn.com.yx.entity.YxBorad [from cn.com.yx.entity.YxInvition as model where model.yxBorad = ?]
问题已经结局,在hql语句中我用字符串拼接不用预编译,同时用String queryString = "from YxInvition as model where model.yxBorad.yxBZj ="+ id;问题可以解决!当然这肯定不是最好的办法 嘿嘿!希望有更好的方法 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询