I've done a couple of projects with hibernate but I can't seem to get this sort of thing to work. I have to classes IncentiveObj and IncentiveOwnerObj I want to return an IncentiveObj for those rows on the IncentiveOwnerObj (related table actually) where the other parts of the where clause are specified that is the first_Name and last_Name match the
string's passed. Both share a field called incentive_id which I am joining on.
I have tried different things the last being to create a contructor on the object I want which accepts a paramter but then I get a list of objects with only that field filled. If I add the other columms to the constructor it doesn't work.
Here is the select string I'm passing to the query currently.
private String INCENTIVE_BY_OWNER = "SELECT new com.amfam.isagent.asit.dataObjects.IncentiveObj(i.incentive_Name)" + "from IncentiveObj i," + " IncentiveOwnerObj io " +
"where i.incentive_Id = io.incentive_Id " + " and io.first_Name = 'Kristie'" + " and io.last_Name = 'Sands'";
Can this sort of thing be done without reading the tables independent of each other and iterating through one of the resulting lists and reading the other table?
Thanks,
Chris