Is JPA QL supposed to be this picky? [message #387027] |
Tue, 07 April 2009 23:51  |
Eclipse User |
|
|
|
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.
|
|
|
|
Re: Is JPA QL supposed to be this picky? [message #387032 is a reply to message #387027] |
Wed, 08 April 2009 14:09   |
Eclipse User |
|
|
|
Hi,
I was about to create an almost similar post.
The problem appears also on EclipseLink 1.1. But it seems it is longer in
the code than that, since 1.0 also had this issue (at least for me).
The thing is that it doesn't happen on TopLink Essentials. I wanted to
switch the persistence provider on GlassFish to EclipseLink and ran into
this problem.
The working query for me was:
SELECT p FROM CombinedTraderMappingBean t, PriceStepBean p
WHERE t.memberId = :memberId
AND t.traderId = :traderId
AND t.exchangeId = p.exchangeId;
If I only swap the beans in the FROM clause it won't work.
Cheers
Chris.
Josh Davis wrote:
[...]
> The SQL generator did not use the table alias t1 in the select clause.
|
|
|
Re: Is JPA QL supposed to be this picky? [message #387033 is a reply to message #387031] |
Wed, 08 April 2009 15:29   |
Eclipse User |
|
|
|
I'm using the 1.0.2 EclipseLink that ships with the 11.1.1.0.1 version of
TopLink. I'm downloading the 1.1.0 version of EclipseLink now. Should I
expect the new version of EclipseLink to work with my existing TopLink, if
I just replace the EclipseLink jars?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 1.41027 seconds