This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have 2 two tables(css_job and css_candidate) with many to many mapping. it is normalized and many to many mappings are put in table called css_candidatejob.
I have to show all the candidates and jobs provided that there is mapping between these two in css_candidatejob.
query is "select c.firstName ,j.title from css_job j inner join css_candidate c"
i am trying to achieve this using hibernate mappings and HQL.
here is my candidate mapping.
here is job mapping.
java beans(Job and Candidate) have private String attributes with the same name and sets with candidates and jobs as names.
here is the code that fires inner join between these two tables.
now my questions is how to show firstName from this result. for timebeing i am trying to print first name for tiem being but need fields from both job and candidate. so i can not specifically say select candidate in query and assign it to candidate Class.
Please suggest. it could be something very simple as i have started working with hibernate very recently.
SCJP 1.4, SCWCD 1.5
Joined: Nov 21, 2006
sorry here is the query that is returning expected results. how should i map in hibernate.
select c.firstName,c.lastName,j.jobTitle,cj.status from css_candidate c,css_candidatejob cj,css_job j where c.candidateSeq = cj.candidateSeq and cj.jobSeq = j.jobSeq
should i have separate mapping file and java bean persistent class for css_candidatejob? and do "from candidateJob". this will return all records in candidateJob table as a list of candidateJob beans. Now how to load candidate and job classes for each of the rows to get firstName and jobTitle?