我有4个表参与此查询。休眠4表的关联
Campaign
- 多对一业务
Business
- 一对多客户
Client
- 一对一接触
Contact
在接触时,现场contact_name
这是独一无二的。我需要检索所有campaigns
相关contact
(通过client
和business
),这campaign
场type
等于2
什么是休眠做到这一点的最好方法是什么?
在SQL是看起来像这样:
select *
from campaign,contact, business, client
where campaign.type=2
and client.contact_id = contact.contact_id
and contact.name = 'Josh'
and client.business_id = business.business_id
and campaign.campaign_id = business.business_id
找到更多的信息这些表格之间的关系是否已经配置了xml或注解或者是问题的一部分? – flesk
我正在使用注释,并且我确实宣布了一对多对多等,但是,我需要一个有效的解决方案来检索结果 – Dejell