I have 3 tables. Master,child1,child2.
Master has one to many relationship with child1.
Master has one to many relationship with child2.
There is no relation between child1 and child2.
I want to retrieve data from all 3 tables in single query using hibernate.
Table - Master
id
11
12
Table - child1
id deposited_date Master_child1_reltion_key
2 2012-10-10 11
3 2012-10-10 11
4 2012-10-10 11
5 2011-01-01 12
6 2005-02-20 13
Table - child2
id phoneNo phone_type master_child2_relation_key
15 1111111 personal 11
16 2222222 office 11
17 3333333 home 11
18 1010100 personal 12
In table child2 there can be none,1,2, or 3 records against Master table.
I wanted to retrieve values from all 3 tables. like
id deposited_date phoneno1 phoneno2 phoneno3
11 2012-10-10 1111111 2222222 3333333
12 2011-01-01 1010100
13 2005-02-20
Is it possible to retrieve data using single query in hibernate or do I need to use multiple queries ?