You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Dave Lamy (JIRA)" <ji...@apache.org> on 2010/09/21 16:05:32 UTC
[jira] Created: (CAY-1483) EJBQL produces invalid SQL when
referencing multiple qualified entities
EJBQL produces invalid SQL when referencing multiple qualified entities
------------------------------------------------------------------------
Key: CAY-1483
URL: https://issues.apache.org/jira/browse/CAY-1483
Project: Cayenne
Issue Type: Bug
Components: Core Library
Affects Versions: 3.0.1
Reporter: Dave Lamy
Priority: Minor
If an EJBQL query references multiple qualified entities (subclasses), the resulting SQL is missing an "AND" in between the two qualifier clauses. Example:
EJBQL:
SELECT COUNT(distinct a.id) FROM Subclass1 AS a JOIN a.subclass2 b WHERE a.name = ?1 AND b = ?2
Produces SQL:
SELECT COUNT(DISTINCT t0.ID) AS sc0 FROM SUBCLASS_1 t0 INNER JOIN SUBCLASS_2 t1 ON (t0.SUBCLASS_2_ID = t1.ID) WHERE t0.QUALIFIER = ? t1.QUALIFIER = ? AND t0.NAME = ? AND t1.ID = ?
Note that there is no AND between t0.QUALIFIER and t1.QUALIFIER.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAY-1483) EJBQL produces invalid SQL when
referencing multiple qualified entities
Posted by "Dave Lamy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAY-1483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12912987#action_12912987 ]
Dave Lamy commented on CAY-1483:
--------------------------------
I have produced a fix for this problem. Patch is attached.
> EJBQL produces invalid SQL when referencing multiple qualified entities
> ------------------------------------------------------------------------
>
> Key: CAY-1483
> URL: https://issues.apache.org/jira/browse/CAY-1483
> Project: Cayenne
> Issue Type: Bug
> Components: Core Library
> Affects Versions: 3.0.1
> Reporter: Dave Lamy
> Priority: Minor
>
> If an EJBQL query references multiple qualified entities (subclasses), the resulting SQL is missing an "AND" in between the two qualifier clauses. Example:
> EJBQL:
> SELECT COUNT(distinct a.id) FROM Subclass1 AS a JOIN a.subclass2 b WHERE a.name = ?1 AND b = ?2
> Produces SQL:
> SELECT COUNT(DISTINCT t0.ID) AS sc0 FROM SUBCLASS_1 t0 INNER JOIN SUBCLASS_2 t1 ON (t0.SUBCLASS_2_ID = t1.ID) WHERE t0.QUALIFIER = ? t1.QUALIFIER = ? AND t0.NAME = ? AND t1.ID = ?
> Note that there is no AND between t0.QUALIFIER and t1.QUALIFIER.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAY-1483) EJBQL produces invalid SQL when
referencing multiple qualified entities
Posted by "Dave Lamy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAY-1483?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dave Lamy updated CAY-1483:
---------------------------
Attachment: EJBQLJoinAppender.java.patch
Added 3 lines of code from EJBQLSelectTranslator.visitWhere that checks the existing length of the buffer and appends an AND in if length > 0.
> EJBQL produces invalid SQL when referencing multiple qualified entities
> ------------------------------------------------------------------------
>
> Key: CAY-1483
> URL: https://issues.apache.org/jira/browse/CAY-1483
> Project: Cayenne
> Issue Type: Bug
> Components: Core Library
> Affects Versions: 3.0.1
> Reporter: Dave Lamy
> Priority: Minor
> Attachments: EJBQLJoinAppender.java.patch
>
>
> If an EJBQL query references multiple qualified entities (subclasses), the resulting SQL is missing an "AND" in between the two qualifier clauses. Example:
> EJBQL:
> SELECT COUNT(distinct a.id) FROM Subclass1 AS a JOIN a.subclass2 b WHERE a.name = ?1 AND b = ?2
> Produces SQL:
> SELECT COUNT(DISTINCT t0.ID) AS sc0 FROM SUBCLASS_1 t0 INNER JOIN SUBCLASS_2 t1 ON (t0.SUBCLASS_2_ID = t1.ID) WHERE t0.QUALIFIER = ? t1.QUALIFIER = ? AND t0.NAME = ? AND t1.ID = ?
> Note that there is no AND between t0.QUALIFIER and t1.QUALIFIER.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.