Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 289677 - SQLSyntaxErrorException Derby, simple query confuses SQL query generator
Summary: SQLSyntaxErrorException Derby, simple query confuses SQL query generator
Status: CLOSED DUPLICATE of bug 277682
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-17 00:28 EDT by Ernie Rael CLA
Modified: 2022-06-09 10:04 EDT (History)
1 user (show)

See Also:


Attachments
stack trace and other error messages (5.85 KB, text/plain)
2009-09-17 00:29 EDT, Ernie Rael CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ernie Rael CLA 2009-09-17 00:28:17 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Build Identifier: 2.0.0.v20090821-r4934

Here is the query that produces the error, the '?1' is a string. This query is like an SQL query rather than a JPQL query; in particular e.eventtypeId is an INT in the database table, but an object in JPA.

Notice that the generated database query has '(t0.ID = )'

Failing query:
    select e from Event e, Eventtype et
    where et.id = e.eventtypeId and et.name = ?1

Correct query:
    select e from Event e
    where ?1 = e.eventtypeId.name

Stacktrace attached

Reproducible: Always

Steps to Reproduce:
1. Can provide entity classes if needed
2.
3.



Call: SELECT ERNIE.EVENT.ID, ERNIE.EVENT.ETIME, ERNIE.EVENT.LONGITUDE, ERNIE.EVENT.LATITUDE, ERNIE.EVENT.PLACE_ACCURACY, ERNIE.EVENT.TZONE, ERNIE.EVENT.TIME_ACCURACY, ERNIE.EVENT.EVENTTYPE_ID FROM ERNIE.EVENTTYPE t0, ERNIE.EVENT t2, ERNIE.EVENTTYPE t1 WHERE (((t0.ID = ) AND (t0.NAME = CAST (? AS VARCHAR(32672) ))) AND (t1.ID = t2.EVENTTYPE_ID))
Comment 1 Ernie Rael CLA 2009-09-17 00:29:59 EDT
Created attachment 147396 [details]
stack trace and other error messages
Comment 2 Tom Ware CLA 2009-09-23 13:10:59 EDT

*** This bug has been marked as a duplicate of bug 277682 ***
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:04:07 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink