我正在使用标准来获取包含活动用户的通知列表。问题是我收到以下错误:
org.hibernate.QueryException: could not resolve property: user.active of: com.company.Notification
除了检查用户是否处于活动状态之外,我还需要检查通知是否属于我想要的类型。这是我的代码:
session.createCriteria("com.company.Notification")
.add(Restrictions.or(Restrictions.eq("type", "email"),
.add(Restrictions.eq("user.active", true)).list();
通知有一个字段User user
,而该字段又具有一个字段Boolean active
我在看这个页面:https ://forum.hibernate.org/viewtopic.php?t=948576&highlight=subproperty
但我仍然不知道如何创建一个标准来访问父对象和子对象中的某些东西。