Criterion.add()查询表的多对一中的表的其它属性为查询条件

A小鱼A 2016-09-26 08:52:30

2张表多对一关联着
Collection<Criterion> criterions = new ArrayList<Criterion>();
criterions.add(Restrictions.eq("fileBasic.organzations",12));
ArrayList<PartyMem> partyMems = (ArrayList<PartyMem>) partyMemService.findByCriterion(start, limit, criterions ,null);
错误消息:2016-09-26 20:36:11,358 ERROR (com.chinavvv.ui.interceptor.ActionTransactionInterceptor:50) - could not resolve property: fileBasic.organzations of: hnsrci.party.domain.PartyMem; nested exception is org.hibernate.QueryException: could not resolve property: fileBasic.organzations of: hnsrci.party.domain.PartyMem
org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: fileBasic.organzations of: hnsrci.party.domain.PartyMem; nested exception is org.hibernate.QueryException: could not resolve property: fileBasic.organzations of: hnsrci.party.domain.PartyMem

问下不能再查询时在多的一方的表上,查询一个不和外键值一样的其它属性吗?
如果查询criterions.add(Restrictions.eq("fileBasic.id",12));就不报错
partyMemService.findByCriterion(start, limit, criterions ,null); 这个封装好的方法
...全文
881 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

3,405

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 设计模式
社区管理员
  • 设计模式
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧