Hi, does one have to map all tables appearing in a query ... Consider the following SQL query ...
Code:
SELECT m.force, m.surname, m.init, a.id,
NVL(a.qualification_name_not_found, b.qualification_name) qual_name,
q.qualcode, m.app_cde,
r.description AS rank
FROM locnavy.MEMBERS m,
nlrd.QUALIFICATION_ENROLMENT a,
nlrd.MASTER_QUALIFICATION b,
JOB_QUAL_LNK c,
RANKS r,
JOB_QUALIFICATION q
WHERE a.id = m.force
AND r.rank_id = m.rank_cde
AND a.qualification_id = b.qualification_id (+)
AND a.qualification_id = c.qualification_id
AND a.learner_achievement_status_id IN (2,32)
AND c.job_qualification_id = q.job_qualification_id"
AND q.qualcode != 'XXX'
AND (m.mustering_cde = '" + mustCode + "' OR '"+ mustCode +"' IS NULL)
AND (m.rank_cde = '" + rankCode+ "' OR '" + rankCode+ "' IS NULL)
AND NVL(m.STATUS,'A') = 'A' AND m.app_cde IN ('MC','MG','MP','PE','PF','PV')
Note that joins are not used as this was written under Oracle 8i ... For the purpose of this query only MEMBERS object/POJO is used to contain the results, other tables appearing here i used to help retrieve the results.
Code:
QUALIFICATION_ENROLMENT
MASTER_QUALIFICATION
JOB_QUAL_LNK
RANKS
JOB_QUALIFICATION
In hibernate SQL/HQL query, would i need to have each table appearing here mapped? Is there a rule that all table joins must be mapped and appearing in hibernate.cfg.xml?