This is something I'd really like to be able to do - resolve names based on id values without fetching the whole child model.
Here is an example of what I have, a Table say Employee and a Name_Details table The Employee may look like this
Create Table Employee {
emp_idinteger not null generated by default as identity; -- generated pk
Department varchar(44);
emp_name_id Integer; -- fk to Name_Details table
...other details such as hire_date etc..
}
now emp_id is a foreign key to the name_details table which may look like this:-
Create Table Name_Details {
id Integer;
Name varchar(32);
Address Varchar(127);
Postcode Varchar(10);
--other details..
}
My question is that I'd like to model the first table Employee with a Java class but I am not interested in setting up a one-to-one relationship between the Employee class and the Name_Details table to fetch that whole Name_details table (as its quite large) the only information I want from this second class is just the Name field (found by joining the emp_name_id column with the Name_Details.id column. So is it possible in JPA to say declare something like a transient variable in my Employee class called say String employeeName and have this retrieved by JPA based on the above relationShip? This is a simplified example of what I have wgere there are several tables with name-value pairs and the master table has the values. I need this for reading and not updating/deleting etc. I am not using JPA v1.x with EJB3 (and not hibernate) on WPS 6.1
Thx G