Not sure if this will help, but it seems similar to a problem that I had in which I was obtaining multiple
types of entities out of one HQL query.
Something like:
Code:
select s.courses, s.name
from Student s
As it is, the above code will return me a Java List, and each member of that list will be List<Course> and a String.
This was not convenient to me. So I created a non-entity POJO as below:
Code:
class NameAndCourse {
private List<Course> studentCourses;
private String studentName;
//Getters and Setters for the above
}
In order to use the POJO above, my HQL query will now read as:
Code:
select s.courses as studentCourses, s.name as studentName
from Student s
And the code that executes the query would read:
Code:
session.createQuery(hql.toString())
.setResultTransformer(org.hibernate.transform.Transformers.aliasToBean(NameAndCourse.class))
.list()
So now, I get a List<NameAndCourse> when the query gets executed.
Again, I haven't tried this with stored procedures, so this might not help you out.