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));			
		}

 

你可能感兴趣的:(hibernate criteria 跨表查询)