Question

For 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%'

I have tried to create this 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))

I'm getting a InvocationException where I'm calling this in getExecutableCriteria to get a result list.

Am I building it correctly?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top