Reputation: 11499
I need tune query for performance. The tree of objects like:
classA {
classB b;
classC c;
.....}
I need select similar to SQL:
select a.field1, b.field2, c.field3, c.field4 from a left outer join b
on a.id=b.fk left outer join c on b.id=c.fk
I don't understand what kind of result will be returned, does it arrayList? Or query returns all 3 objects? Thanks.
Upvotes: 0
Views: 466
Reputation: 8014
The result which would be returned by the query would be type of -
List<Object[]>
Upvotes: 2
Reputation: 5230
If you use HQL I think you use hibernate. Provide mapping with relations (ManyToOne or OneToOne) to your objects:
class A {
@ManyToOne
pribvate B b;
@OneToOne
private C c;
}
Then use session methods to select your object A with hql query of criteria. Hibernate do all joins for you automatically. And it will return List of A.
Upvotes: 1