This is an automated email from the ASF dual-hosted git repository.
ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push:
new 66942b6 Skip toOne relationships not to PK in result columns
66942b6 is described below
commit 66942b6be70960fa64c2d9ff586cfca04e5b928e
Author: Nikita Timofeev <[email protected]>
AuthorDate: Wed Feb 20 14:37:50 2019 +0300
Skip toOne relationships not to PK in result columns
---
.../access/translator/select/DescriptorColumnExtractor.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/DescriptorColumnExtractor.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/DescriptorColumnExtractor.java
index 43f521e..95a26ea 100644
---
a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/DescriptorColumnExtractor.java
+++
b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/DescriptorColumnExtractor.java
@@ -99,8 +99,12 @@ class DescriptorColumnExtractor extends BaseColumnExtractor
implements PropertyV
@Override
public boolean visitToOne(ToOneProperty property) {
ObjRelationship rel = property.getRelationship();
- // outer join should be used for to-one relationships
- PathTranslationResult result =
pathTranslator.translatePath(rel.getSourceEntity(), property.getName() + '+',
prefix);
+ if(!rel.isToPK()) {
+ // should ignore toOne not on PK relationship as it doesn't have
any column to add to result
+ return true;
+ }
+
+ PathTranslationResult result =
pathTranslator.translatePath(rel.getSourceEntity(), property.getName(), prefix);
int count = result.getDbAttributes().size();
for(int i=0; i<count; i++) {