Palani G created OPENJPA-2692:
---------------------------------
Summary: Generated query does not have enough parentheses
Key: OPENJPA-2692
URL: https://issues.apache.org/jira/browse/OPENJPA-2692
Project: OpenJPA
Issue Type: Bug
Affects Versions: 2.4.0
Reporter: Palani G
Priority: Blocker
Here is the JPQL
SELECT process FROM com.aa.bb.Process process WHERE ((((process._server._id =
:server_id and UPPER(process._processId) = :processId) and
UPPER(process._processName) = :processName) and UPPER(process._origNode) =
:origNode) or (((process._server._id = :server_id2 and
UPPER(process._processId) = :processId2) and UPPER(process._processName) =
:processName2) and UPPER(process._origNode) = :origNode2))]
Incorrect query generated openJPA
--> [SELECT t0.PROCESS_ID, t0.ORIG_NODE, t0.PROC_ID, t0.PROC_NAME, FROM
PROCESS_TABLE t0 WHERE (t0.SERVER_ID = ? AND UPPER(t0.PROC_ID) = ? AND
UPPER(t0.PROC_NAME) = ? AND UPPER(t0.ORIG_NODE) = ? OR t0.SERVER_ID = ? AND
UPPER(t0.PROC_ID) = ? AND UPPER(t0.PROC_NAME) = ? AND UPPER(t0.ORIG_NODE) = ?)]
This should be the correct query generated by openjpa
SELECT t0.PROCESS_ID, t0.ORIG_NODE, t0.PROC_ID, t0.PROC_NAME, FROM
PROCESS_TABLE t0 WHERE
( (t0.SERVER_ID = ? AND UPPER(t0.PROC_ID) = ? AND UPPER(t0.PROC_NAME) = ? AND
UPPER(t0.ORIG_NODE) = ? ) OR (t0.SERVER_ID = ? AND UPPER(t0.PROC_ID) = ? AND
UPPER(t0.PROC_NAME) = ? AND UPPER(t0.ORIG_NODE) = ?))
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)