问题
I have this HQL query which returns me an Empty Resultset :
FROM MeetingSchedule ms JOIN FETCH ms.client JOIN FETCH ms.employees JOIN FETCH ms.parts
WHERE ms.meetingId = :meetingId;
If I execute SQL Query gives me result
select * from meeting_schedule where meeting_id = ?;
How to debug this query?
What will be the cause for Empty Resultset ?
PS:
SQL Query is just to inform you that my MeetingSchedule is not null, I can post generated SQL Query here if you want.
Thank you in advanced.
回答1:
Those are 2 different queries. In HQL you are using JOINS while in SQL not. Do the comparision of results of EXACT the same queries. Answer is ratjher simple - some of relations are missing causing join to fail, excluding given row in result.
Equivalent of SQL you have shown is
FROM MeetingSchedule ms WHERE ms.meetingId = :meetingId;
I bet that result will not be empty.
来源:https://stackoverflow.com/questions/45103580/hql-query-returning-empty-resultset