hibernate criteria cross-table query

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

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326528647&siteId=291194637