Hi,

I have a jpa query like this,
select p.training.recordId,count(p.training.recordId),
sum(case when p.applicableYN = 0 then 1 else 0 end),
sum(case when p.personnelTrainingStatus.code = 3 then 1 else 0 end),
sum(case when (p.readUnderstoodYN = 1 and p.personnelTrainingStatus.code = 3) then 1 else 0 end)
from TrainingPersonnel p where p.assignmentNum is null and p.publishedYN = 1 group by p.training.recordId


When its executed through eclipse link,
SELECT t0.RECORD_ID, COUNT(t0.RECORD_ID), SUM(CASE WHEN (t2.CODE = ?) THEN ? ELSE ? END), SUM(CASE WHEN (t2.CODE = ?) THEN ? ELSE ? END), SUM(CASE WHEN (t2.CODE = ?) THEN ? ELSE ? END) FROM AGW_TRAININGS t0, CODELIST_CODE t2, AGW_TRAINING_PERSONNELS t1 WHERE (((t1.ASSIGNMENT_NUM IS NULL) AND (t1.PUBLISHED_YN = ?)) AND ((t0.RECORD_ID = t1.TRAINING_ID) AND (t2.RECORD_ID = t1.PERSONNEL_TRAINING_STATUS))) GROUP BY t0.RECORD_ID")

What is the problem? Is there anything wrong in jpa query?
Please help me.

Thank you,
Kavitha