2011-07-21 100 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 

感谢。

回答