Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Problem in CONCAT function and JOIN - Incorrect SQL

This looks like bug in EL. Please file bug in Bugzilla: https://bugs.eclipse.org/bugs/enter_bug.cgi
Product: RT
Project: EclipseLink
Component: JPA

Thanks

Tomas

Dne 4/7/15 v 12:58 PM Rama Rao napsal(a):
Hi,
We have the following model
CustomObject has 1:N relationship with CustomObjectCharacteristic.

The following JPQL generates incorrect SQL

JPQL
=====

select FUNC(CONCAT, var1.value,var2.value)  from CustomObject obj, CustomObject obj1,CustomObjectCharacteristic var1, CustomObjectCharacteristic var2

WHERE obj.name = :pParam0

AND obj.name = obj1.name

AND var1.charOwner = obj

AND var1.name="EL_Char1"

AND var2.charOwner = obj1

AND var2.name="EL_Char2"



SQL

====

SELECT CONCAT(t0.VALUE, t0.VALUE) FROM CUSTOMOBJECT_CHAR t3, CustomObject t2, CustomObject t1, CUSTOMOBJECT_CHAR t0 WHERE ((((((((t1.NAME = ?) AND (t1.NAME = t2.NAME)) AND (t0.CHAROWNER = t1.ENTITYID)) AND (t0.NAME = ?)) AND (t3.CHAROWNER = t2.ENTITYID)) AND (t3.NAME = ?)) AND (t1.ENTITYCLASS = ?)) AND (((t2.ENTITYCLASS = ?) AND (t0.ENTITYCLASS = ?)) AND (t3.ENTITYCLASS = ?))) 


See in the Concat function it tries to concatinate the same value (t0.VALUE). Th e expectation is to generate the Concat function as CONCAT(t0.VALUE, t3.VALUE).


The same is true for JPQL Concat

If we remove the CONCAT function, just select value it works fine.


Is this a bug in EL? Is there any work around available?


Thanks,

Rama

 


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top