我正在尝试跟踪查询以从表中获取数据。
from PostMessageUsers as pmu
left join fetch pmu.atomByReceivedBy as recBy
left join fetch recBy.smsusers as recByDtl
left join fetch recBy.profilePics as profilePic
问题是在执行时它正在执行两个查询,如下所示
Hibernate: select postmessag0_.id as id8_0_, atom1_.id as id9_1_, smsusers2_.aid as aid39_2_, profilepic3_.pic_id as pic1_23_3_, postmessag0_.received_by as received2_8_0_, postmessag0_.shared_of as shared3_8_0_, postmessag0_.sent_by as sent4_8_0_, postmessag0_.author as author8_0_, postmessag0_.messageid as messageid8_0_, postmessag0_.adddate as adddate8_0_, postmessag0_.status as status8_0_, postmessag0_.deleted_time as deleted9_8_0_, atom1_.name as name9_1_, atom1_.type as type9_1_, atom1_.adddate as adddate9_1_, atom1_.status as status9_1_, atom1_.deldate as deldate9_1_, smsusers2_.mobno as mobno39_2_, smsusers2_.password as password39_2_, smsusers2_.fname as fname39_2_, smsusers2_.lname as lname39_2_, smsusers2_.mailid as mailid39_2_, smsusers2_.dob as dob39_2_, smsusers2_.gender as gender39_2_, smsusers2_.registerdate as register9_39_2_, smsusers2_.city as city39_2_, smsusers2_.mobnovarification as mobnova11_39_2_, smsusers2_.mailidvarification as mailidv12_39_2_, smsusers2_.first_login as first13_39_2_, smsusers2_.mail_subscription as mail14_39_2_, smsusers2_.time_zone as time15_39_2_, smsusers2_.reg_date as reg16_39_2_, profilepic3_.aid as aid23_3_, profilepic3_.profile_pic_path as profile3_23_3_, profilepic3_.small_pic_path as small4_23_3_, profilepic3_.adddate as adddate23_3_, profilepic3_.aid as aid9_0__, profilepic3_.pic_id as pic1_0__ from xrcwrn_sms.post_message_users postmessag0_ left outer join xrcwrn_sms.atom atom1_ on postmessag0_.received_by=atom1_.id left outer join xrcwrn_sms.smsusers smsusers2_ on atom1_.id=smsusers2_.aid left outer join xrcwrn_sms.profile_pic profilepic3_ on atom1_.id=profilepic3_.aid
Hibernate: select basicprofi0_.aid as aid12_0_, basicprofi0_.relationship_status as relation2_12_0_, basicprofi0_.about_me as about3_12_0_ from xrcwrn_sms.basic_profile basicprofi0_ where basicprofi0_.aid=?
如何解决此问题,以便只应触发一个查询来获取数据?