DetachedCriteria 连表查询 需要设定别名



DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Payment.class,"p");
detachedCriteria.createAlias("order", "od");
detachedCriteria.add(Restrictions.eq("od.sellerId",pager.getSellerId()));
return this.findByPager(pager, detachedCriteria);


如果不设定别名,就报莫名奇妙的错误.

你可能感兴趣的:(Hibernate)