jpa - Condition left join in CriteriaQuery -
Hi everyone I'm trying to do it in CriteriaQuery, I was searching for so long but let me do this Did not get anything, could someone help me?
SELECT b.name Add a left OUTER to the apple Deplo b on (a.id_depl = b.id_depl) and b.id_place = 2; I'm just trying to make a condition in the left unbreakable clause, I looked at the ".on" function, but I do not know how it works and how it works I tried to do something like this:
Join Table 1, Table 2j1 = Route. Joint (Table 1Table2, Joint Type, LEFT) .on (cb.and ( Cb.equal (table2_ someid, someId)); But it needs to create a Boolean expression.
on section has been introduced in JPA 2.1. An example solution:
Benchmark CB = em.getCriteriaBuilder (); CriteriaQuery & LT; String & gt; Cq = cb.createQuery (String.class); The root of the & lt; Empl & gt; A = cq.from (Empl.class); Join & LT; Empl, deplo & gt; B = A.joined ("B", JointTip; LEFT); // Left external participant B.O.N. (CB and AZT ("id_place"), CB parameters (integer class, "id place"), CB.Agele (B.Get ("id_depl"), A.get ("id_depl")))); Cq.select (b & lt; string & gt; mill ("name")); & Lt; String & gt; Results = em.createQuery (cq) .setParameter ("idPlace", 2) .getResultList ();
Comments
Post a Comment