[
https://issues.apache.org/jira/browse/CAY-1712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13406347#comment-13406347
]
Andrus Adamchik commented on CAY-1712:
--------------------------------------
Also seems to be fixed in 3.1. The code above looks like this:
else if (pathPart instanceof DbRelationship) {
DbRelationship rel = (DbRelationship) pathPart;
dbRelationshipAdded(rel, JoinType.LEFT_OUTER, null);
}
> Generate LEFT OUTER join instead of INNER one when selecting via base class
> ---------------------------------------------------------------------------
>
> Key: CAY-1712
> URL: https://issues.apache.org/jira/browse/CAY-1712
> Project: Cayenne
> Issue Type: Bug
> Components: Core Library
> Affects Versions: 3.0.2
> Reporter: Pavel Dyadych
>
> I have the same problem as here:
> http://cayenne.195.n3.nabble.com/Problem-querying-vertical-inheritance-tp3486975.html
> The idea is that then having more when one derived class for a base class and
> trying to query base class - you get nothing, because improper SQL query is
> built:
> SELECT t0.TYPE, t1.BAR, t2.FOO, t0.ID FROM ITEM t0 JOIN ITEM_BAR t1 ON (t0.ID
> = t1.ID) JOIN ITEM_FOO t2 ON (t0.ID = t2.ID)
> instead of:
> SELECT t0.TYPE, t1.BAR, t2.FOO, t0.ID FROM ITEM t0 LEFT JOIN ITEM_BAR t1 ON
> (t0.ID = t1.ID) LEFT JOIN ITEM_FOO t2 ON (t0.ID = t2.ID)
> Looks like in
> org."apache.cayenne.access.trans.SelectTranslator#appendQueryColumns" when
> checking "pathPart" if it is instance of "DbRelationship" there should be
> also a check for depPK. I mean instead of:
> ...
> else if (pathPart instanceof DbRelationship) {
> DbRelationship rel = (DbRelationship) pathPart;
> dbRelationshipAdded(rel, JoinType.INNER, null);
> }
> there should be something like
> ...
> else if (pathPart instanceof DbRelationship) {
> DbRelationship rel = (DbRelationship) pathPart;
> dbRelationshipAdded(rel, rel.isToDependentPK() ? JoinType.LEFT_OUTER :
> JoinType.INNER, null);
> }
> This case, when you perform SelectQuery(Item.class) - you get all the
> instances of all subclasses of Item.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira