hibernate criteria 跨表查询

		if(StringUtils.isNotBlank(qo.getOwnerShop())){
			//cr.add(Restrictions.eq("quanType.ownerShop", qo.getOwnerShop()));
			String sql = String.format("EXISTS (SELECT * from q_type g where   this_.quanType_ID=g.ID and ownerShop='%s' )", 
			qo.getOwnerShop()	);
			cr.add(Restrictions.sqlRestriction(	sql));			
		}

猜你喜欢

转载自xinglijun1973.iteye.com/blog/2343773