Issue Details (XML | Word | Printable)

Key: NUCRDBMS-792
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Ivan Badia
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

Map.containsKey generates invalid query

Created: 25/Apr/14 09:27 AM   Updated: 25/Apr/14 09:29 AM
Component/s: Queries
Affects Version/s: 3.2.12
Fix Version/s: None

File Attachments: 1. Zip Archive NUCRDBMS-792.zip (479 kB)


Datastore: Microsoft SQL Server
Severity: Development


 Description  « Hide
When we use the JDOQL method containsKey over a Map parameter, the sql generated is invalid. The condition is added outside the EXISTS() function

In the testcase attached the SQL query generated is:

SELECT DISTINCT 'mydomain.model.PersonGroup' AS NUCLEUS_TYPE
,A0.ID
,A0."NAME"
FROM PERSONGROUP A0
LEFT OUTER JOIN FAMILY B0 ON A0.FAMILY_ID_OID = B0.ID
WHERE (B0.ID IN (1))
AND EXISTS (
SELECT 1
FROM PERSONGROUPCARRELATION A0_SUB
INNER JOIN PERSON B0_SUB ON A0_SUB.PERSON_ID_OID = B0_SUB.ID
WHERE A0_SUB.RELATION_ID_OWN = A0.ID
)
AND (
(
1 = B0_SUB.ID
OR 2 = B0_SUB.ID
)
)

When the expected query would be:


SELECT DISTINCT 'mydomain.model.PersonGroup' AS NUCLEUS_TYPE
,A0.ID
,A0."NAME"
FROM PERSONGROUP A0
LEFT OUTER JOIN FAMILY B0 ON A0.FAMILY_ID_OID = B0.ID
WHERE (B0.ID IN (1))
AND EXISTS (
SELECT 1
FROM PERSONGROUPCARRELATION A0_SUB
INNER JOIN PERSON B0_SUB ON A0_SUB.PERSON_ID_OID = B0_SUB.ID
WHERE A0_SUB.RELATION_ID_OWN = A0.ID
AND B0_SUB.ID IN (
1
,2
)
)


If you require additional information, please, let me know.


Ivan Badia made changes - 25/Apr/14 09:29 AM
Field Original Value New Value
Attachment NUCRDBMS-792.zip [ 12063 ]