는이 같은 JPQL에 SQL 간단한 쿼리를하고도 그 작업을 할 수 있습니다SQL 쿼리에서 jpql 쿼리를 얻는 방법?
Query query = em.createQuery("SELECT p2 FROM Zp01 p2 where p2.gestionnaire IN (SELECT d.libelle FROM Affaire d)") ;
liszp01general= (List<Zp01>) query.getResultList();
하지만 난 이미 SQL에서 작업 그게 전부 JPQL이 쿼리 번역 캔트 :이 있지만 didnt가 시도
SELECT p2.* from zp01 p2 join (SELECT TYPEC,count(TYPEC) as cnt_typec FROM planning_cuisson group by TYPEC HAVING COUNT(TYPEC) > 0) p1 where p2.type_cuisson=p1.typec order by cnt_typec asc ;
을 작업 :
Query query = em.createQuery("SELECT p2 FROM Zp01 p2 join (select G.TYPEC,count(G.TYPEC) as cnt_typec from PlanningCuisson G group by G.TYPEC HAVING COUNT(G.TYPEC) > 0) p1 Where p2.typeCuisson=p1.typec and p2.ordre NOT IN (SELECT k.numof FROM OfSemiplanifie k) AND p2.gestionnaire IN (SELECT d.libelle FROM Affaire d) order by cnt_typec asc");
liszp01general= (List<Zp01>) query.getResultList();
후은, Collections.sort와
Zp01 P2로부터 P2를 선택 : 그래서 쿼리의 라인을 따라 뭔가 될 것 , G.TYPEC HAVING COUNT (G.TYPEC)> 0) p1로 PlanningCuisson G 그룹의 cnt_typec으로 G.TYPEC, count (G.TYPEC)를 선택하십시오. 여기서 p2.typeCuisson = p1.typec 및 p2.ordre NOT IN k.numofofSemiplanifie k) 및 p2.gestionnear IN (SELECT d.libelle FROM Affaire d) p1.cnt_typec 오름차순) ");' – marouanoviche