Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Is JPA QL supposed to be this picky?
Is JPA QL supposed to be this picky? [message #387027] Tue, 07 April 2009 19:51 Go to next message
Josh Davis is currently offline Josh Davis
Messages: 10
Registered: July 2009
Junior Member
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 #387031 is a reply to message #387027] Wed, 08 April 2009 09:39 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

That is odd. What version are you using, could you try this on 1.1 and
see if the same error occurs as it may have been fixed. If the error
still occurs please log a bug.

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html


James : Wiki : Book : Blog : Twitter
Re: Is JPA QL supposed to be this picky? [message #387032 is a reply to message #387027] Wed, 08 April 2009 10:09 Go to previous messageGo to next message
Christoph John is currently offline Christoph John
Messages: 10
Registered: July 2009
Junior Member
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 11:29 Go to previous messageGo to next message
Josh Davis is currently offline Josh Davis
Messages: 10
Registered: July 2009
Junior Member
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?
Re: Is JPA QL supposed to be this picky? [message #387036 is a reply to message #387033] Wed, 08 April 2009 12:20 Go to previous messageGo to next message
Josh Davis is currently offline Josh Davis
Messages: 10
Registered: July 2009
Junior Member
I was able to replace the eclipselink.jar without incidence, but I still
see the same behavior. I'll post a bug.
Re: Is JPA QL supposed to be this picky? [message #387040 is a reply to message #387036] Thu, 09 April 2009 01:53 Go to previous messageGo to next message
Christoph John is currently offline Christoph John
Messages: 10
Registered: July 2009
Junior Member
Josh Davis wrote:

> I was able to replace the eclipselink.jar without incidence, but I still
> see the same behavior. I'll post a bug.

Hi,

can you please post the BugID then?

Thanks,
Chris.
Re: Is JPA QL supposed to be this picky? [message #387077 is a reply to message #387040] Fri, 10 April 2009 08:30 Go to previous message
Josh Davis is currently offline Josh Davis
Messages: 10
Registered: July 2009
Junior Member
> can you please post the BugID then?
It's in Oracle BugDB as bug ID 8418894 and here as 271888
https://bugs.eclipse.org/bugs/show_bug.cgi?id=271888
Previous Topic:merge does not copy basic mappings
Next Topic:Having clause - more unexpected pickiness
Goto Forum:
  


Current Time: Thu Apr 17 14:32:55 EDT 2014

Powered by FUDForum. Page generated in 0.02508 seconds