我有 3 张桌子。大师,孩子1,孩子2。
Master 与 child1 有一对多的关系。
Master与child2有一对多的关系。
child1 和 child2 之间没有关系。
我想使用休眠在单个查询中从所有 3 个表中检索数据。
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
在表 child2 中,Master 表可以有 none、1、2 或 3 条记录。
我想从所有 3 个表中检索值。喜欢
id deposited_date phoneno1 phoneno2 phoneno3
11 2012-10-10 1111111 2222222 3333333
12 2011-01-01 1010100
13 2005-02-20
是否可以在休眠中使用单个查询来检索数据,还是需要使用多个查询?