2011-07-21 46 views
2

我遇到了一個問題,無法前進,因爲我無法從SQL轉換到HSQL。這是德SQL:SQL到Hibernate查詢轉換

SELECT * FROM live_information i, live_matches_away ma, live_matches_home mh, 
live_matches m LEFT JOIN live_periods lp ON lp.match_id=m.id LEFT JOIN live_results r ON 
r.match_id=m.id LEFT JOIN live_scorers s ON s.match_id=m.id WHERE i.match_id=m.id AND 
ma.match_id=m.id AND mh.match_id=m.id AND day=20 AND month=07 AND year=2011 

我把它轉換到休眠模式,但我得到一個錯誤,我不明白怎麼JOIN LEFT可以不開?

這是我的HSQL:

from LiveMatches m, LiveInformation i, LiveMatchesAway ma, LiveMatchesHome mh left join 
LivePeriods lp on lp.liveMatches.id=m.id left join LiveResults r on 
r.liveMatches.id=m.id left join LiveScorers s on s.liveMatches.id=m.id where 
i.liveMatches.id=m.id AND ma.liveMatches.id=m.id AND mh.liveMatches.id=m.id AND 
lp.liveMatches.id=m.id AND r.liveMatches.id=m.id AND s.liveMatches.id=m.id AND m.day=" 
+ day + " AND m.month=" + month + " AND m.year=" + year; 

這是錯誤:

org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: on near 
line 1, column 224 

感謝。

回答