JPA Join Query to display a sectorname from a sectorID foreign key table
Post by:Jay Tai
, Ranch Hand
My application shows a list oof projects which should include the name of the sector and the name of the country for each project. I"m using Netbeans 7.3 and automatically generating the JPA classes. The list in the JSF page shows projects, description, the sector ID (foreign key), country ID (foreign key). Instead of showing the numeric ID values, I would like the list to show the corresponding string values of the foreign keys (ie: instead of showing sector ID, I"d lik to show sectorname corresponding to the ID).
I try to modify the NamedQuery field in the entity class of the projects table from:
I then create a property for the sectorname (below the sectorID) and write the getters and setters for the sector name. I add the sectorname title in the JSF page and get the following error:
I'm really not sure how to correctly create a JOIN query so that the string are pulled in the project list from the foreign key tables (sector and country). Would apprecoate any advice. I've included the main classes of the app. Please let me know if i need to cut down or add any information. Thanks in advance!
This thread has been viewed 2244 times.
All times above are in ranch (not your local) time.
The current ranch time is Oct 19, 2018 04:58:01.