Casey
I'll take a best guess at the solution to your problem...
To restate your issue: you cannot cast your results into Coordinator objects.
This is happening because you are joining tables explicitly (without fetching). What you get back as your results is a list of Object[] (List<Object[]>
. The first element in your array is the Coordinator and the second is the Doctor. From what I can tell, this explicit join is unnecessary for two reasons:
1) Since you are looking for the doctor.id in the where clause, the keyword 'left' is unnecessary. You will always only get rows bach that have a matching doctor.
2) Hibernate allows you to use implicity joins that traverse the object graph and allow you to use those values in your where clause. Unlike an explicit join, this will only return to you a List of object in your from clause (List<Doctor>
.
For example:
Your query will probably give you back what you want if it were coded like this: