[英]Criteria listing query with restriction on sub entity non primary key issue
I want to use hibernate criteria with restriction on sub entity non key field for listing objects.我想使用 hibernate 标准来限制子实体非关键字段来列出对象。
criteria.add(Restrictions.eq("template.orientation", orientation)); criteria.add(Restrictions.eq("template.orientation",orientation));
where "template.orientation" is a field in articleTemplate.template其中“template.orientation”是 articleTemplate.template 中的一个字段
when I am trying to run this the following exception fired.当我试图运行这个时,触发了以下异常。
org.hibernate.QueryException: could not resolve property: template.orientation of: com.media.web.bean.ArticleTemplate org.hibernate.QueryException:无法解析属性:template.orientation of:com.media.web.bean.ArticleTemplate
can you help me?你能帮助我吗?
Do you have the getters and setters in ArticleTemplate?您在 ArticleTemplate 中有 getter 和 setter 吗? ie:
template.getOrientation() and template.setOrientation(Orientation)
?即:
template.getOrientation() and template.setOrientation(Orientation)
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.