0
@NamedQuery(name = "Bookings.findBookedRoomByRoomTypeid", query = "SELECT b.roomno FROM Bookings b, Room r WHERE (b.status = 'checkin') AND (b.roomno = r.oid) AND (r.temproomtypeid = :temproom)" ),

例外是

Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.oid)) AND (t2.temproomtypeid = 1)) AND (t0.oid = t1.roomno))' at line 1
Error Code: 1064
Call: SELECT t0.oid, t0.floorno, t0.temproomtypeid, t0.roomtypeid FROM room t0, room t2, bookings t1 WHERE ((((t1.status = ?) AND (t1.roomno = t2.oid.t2.oid)) AND (t2.temproomtypeid = ?)) AND (t0.oid = t1.roomno))
    bind => [2 parameters bound]
4

1 回答 1

0

You could try it like this

SELECT b.roomno FROM Bookings b, Room r WHERE (b.status = 'checkin') AND (b.roomno =:r.oid) AND (r.temproomtypeid =:temproom)
于 2013-09-16T10:51:48.830 回答