【问题标题】:Criteria listing query with restriction on sub entity non primary key issue限制子实体非主键问题的条件列表查询
【发布时间】:2011-10-01 06:23:24
【问题描述】:

我想使用休眠条件限制子实体非关键字段来列出对象。

criteria.add(Restrictions.eq("template.orientation",orientation));

其中“template.orientation”是articleTemplate.template中的一个字段

当我尝试运行此程序时,会触发以下异常。

org.hibernate.QueryException:无法解析属性:com.media.web.bean.ArticleTemplate 的 template.orientation

你能帮帮我吗?

【问题讨论】:

  • 请通过显示您的实体及其关系以及用于创建 Criteria 实例的代码来澄清。
  • 也许 comrad 674714 也应该开始在他的一些答案中投票。

标签: java hibernate spring hibernate-mapping


【解决方案1】:

ArticleTemplate 中有 getter 和 setter 吗? 即:template.getOrientation() and template.setOrientation(Orientation)?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-14
    相关资源
    最近更新 更多