我下面具有与其关系的实体
JobAddress - JobHeader jobHeader
JobHeader - List<Job> jobs
Job - JobHeader
ProjectPhaseAddress - Job job, ConstructionMetric cm, JobAddress jobAddress
ConstructionMetric - Job job
尝试为以下查询建立休眠条件。如何通过使用AND条件遍历多个表来建立标准。
SELECT JA.* FROM JOB_ADDRESS JA
JOIN JOB_HEADER JH ON JH.ADDRESS_ID = JA.ADDRESS_ID
JOIN JOB J on J.J_HEADER_ID = JH.ID
JOIN PROJECT_PHASE_ADDRESS PPA ON PPA.ADDRESS_ID = JA.ADDRESS_ID AND PPA.JOB_ID = J.ID
JOIN CONST_METRIC CM ON CM.ID = PPA.CONST_METRIC_ID AND CM.JOB_ID = J.ID
WHERE JH.ID = 125656