[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] Is JPA QL supposed to be this picky?

This query succeeds:
select city from VCity city, VState state where city.stateId = state.stateId


but this query generates invalid SQL:
select city from VCity city, VState state where state.stateId = city.stateId


The only difference is that the order of the fields in the one where clause is reversed.

The SQL generated by the first query is:
SELECT t0.CITY_ID, t0.STATE_ID, t0.CITY_CODE, t0.CITY_NAME, t0.CREATE_TIME, t0.UPDATE_TIME, t0.LATITUDE, t0.LONGITUDE, t0.TIMEZONE, t0.NOTES FROM VCRYPT_CITY t0, VCRYPT_STATE t1 WHERE (t0.STATE_ID = t1.STATE_ID)


But the SQL generated by the second query is:
SELECT VCRYPT_CITY.CITY_ID, VCRYPT_CITY.STATE_ID, VCRYPT_CITY.CITY_CODE, VCRYPT_CITY.CITY_NAME, VCRYPT_CITY.CREATE_TIME, VCRYPT_CITY.UPDATE_TIME, VCRYPT_CITY.LATITUDE, VCRYPT_CITY.LONGITUDE, VCRYPT_CITY.TIMEZONE, VCRYPT_CITY.NOTES FROM VCRYPT_STATE t0, VCRYPT_CITY t1 WHERE (t0.STATE_ID = t1.STATE_ID)


The SQL generator did not use the table alias t1 in the select clause.