I get an error when using the following named query, am I doing something wrong.
@NamedQuery(name = "TblStationActionCodes.findNextByStationName", query = "SELECT t FROM TblStationActionCodes t, TblStationStations t1 WHERE t1.stationName = :stationName and t.stationId = t1.stationId AND t.isSentFlag = false")
This results in an error in Glassfish as shown below:
SELECT t1.action_code_id AS a1, t1.action_code AS a2, t1.comment_text AS a3, t1.creation_date AS a4, t1.is_sent_flag AS a5, t1.sent_date AS a6, t1.station_id AS a7 FROM tbl_station_stations t0, tbl_station_action_codes t1 WHERE (((t0.station_name = ?) AND (t1.station_id = t0.station_id.t0.station_id)) AND (t1.is_sent_flag = ?)) LIMIT ?, ?
The problem obviously being the following
t1.station_id = t0.station_id.t0.station_id
Is this a bug or is there something in my named query definition that I am doing wrong?