对于SQL
SELECT PP.m, PP.f, PP.l, PP.c, RP.n as 'RPn' FROM P as PP
INNER JOIN RPP AS RP ON PP.id = RP.id
WHERE PP.m LIKE '%0%' OR PP.f LIKE '%0%' OR PP.l LIKE '%0%' OR RPP.n LIKE '%0%'
我尝试创建此DetatchedCriteria
:
DetachedCriteria query = DetachedCriteria.forClass(P.class, "P")
//.setFetchMode("RP", FetchMode.JOIN)
.createAlias("rp", "rp")
.add(Restrictions.disjunction()
.add(Restrictions.like("P.m", str, MatchMode.ANYWHERE))
.add(Restrictions.like("P.f", str, MatchMode.ANYWHERE))
.add(Restrictions.like("P.l", str, MatchMode.ANYWHERE))
.add(Restrictions.like("rp.n", str, MatchMode.ANYWHERE))
我收到InvocationException
,我在getExecutableCriteria
中调用此内容以获得结果list
。
我是否正确构建了它?