SQL to Hibernate query conversion
I came across a problem and can not move forward because I cannot get converted from SQL to HSQL. This is de SQL:
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
I converted it to Hibernate, but I am getting an error, and I don't understand how LEFT JOIN can be without ON?
This is my 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.liveMat开发者_高级运维ches.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;
This is the error:
org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: on near
line 1, column 224
Thanks.
Try replacing on
with with
.
You might want to have a look here: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html
精彩评论