Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] EclipseLink converts query wrong


----- Original Message ----- From: "cowwoc" <cowwoc@xxxxxxxxxxxxxxxx>
To: <eclipselink-users@xxxxxxxxxxx>
Sent: Friday, January 02, 2009 10:24 AM
Subject: Re: [eclipselink-users] EclipseLink converts query wrong



I'll give that a try, thanks! :)

Any chance that EclipseLink can detect non-supported functionality and throw
a clearer error message?

Please log a bug.


Gili


Andrei Ilitchev wrote:

The spec. doesn't allow using entities directly with IN (see spec. 4.6.8
and
4.14), so instead of
"select image from Image as image where image in (select imageToTag0.image
...
use something like:
"select image from Image as image where image.id in (select
imageToTag0.image.id ...

----- Original Message ----- From: "cowwoc" <cowwoc@xxxxxxxxxxxxxxxx>
To: <eclipselink-users@xxxxxxxxxxx>
Sent: Wednesday, December 31, 2008 3:34 PM
Subject: [eclipselink-users] EclipseLink converts query wrong



Hi,

I invoke EntityManager.createQuery("select image from Image as image
where
image in (select imageToTag0.image from ImageToTag as imageToTag0 where
imageToTag0.tag = :tag0) and image in (select imageToTag1.image from
ImageToTag as imageToTag1 where imageToTag1.tag = :tag1) order by
image.id");

EclipseLink 1.0.2 converts this to:

"t0.ID, t0.VERSION, t0.creationDate, t0.parentId, t0.ownerId, t0.dataId,
t0.contentTypeId, t0.specificationId, t0.overlayId FROM image t0 WHERE (
IN
(SELECT t1.ID, t1.VERSION, t1.creationDate, t1.parentId, t1.ownerId,
t1.dataId, t1.contentTypeId, t1.specificationId, t1.overlayId FROM
image_to_tag t2 LEFT OUTER JOIN image t1 ON (t1.ID = t2.IMAGE_ID) WHERE
(t2.TAG_ID = ?)) AND  IN (SELECT t3.ID, t3.VERSION, t3.creationDate,
t3.parentId, t3.ownerId, t3.dataId, t3.contentTypeId, t3.specificationId,
t3.overlayId FROM image_to_tag t4 LEFT OUTER JOIN image t3 ON (t3.ID =
t4.IMAGE_ID) WHERE (t4.TAG_ID = ?))) ORDER BY t0.ID ASC" under MySQL.

Notice how it produces this malformed SQL: "WHERE ( IN". Any ideas?

Gili
--
View this message in context:
http://www.nabble.com/EclipseLink-converts-query-wrong-tp21236806p21236806.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



--
View this message in context: http://www.nabble.com/EclipseLink-converts-query-wrong-tp21236806p21252641.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users




Back to the top