You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2023/04/11 13:23:51 UTC
[cayenne] branch master updated: CAY-2805 Stop calling exp parser internally
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 e77da423b CAY-2805 Stop calling exp parser internally
e77da423b is described below
commit e77da423b4894cb65d5d5cb2114ae92e9644dbdf
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Tue Apr 11 16:22:42 2023 +0300
CAY-2805 Stop calling exp parser internally
---
RELEASE-NOTES.txt | 1 +
.../apache/cayenne/access/PrefetchProcessorJointNode.java | 2 +-
.../access/translator/select/PrefetchNodeStage.java | 14 ++++++++++----
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 3f29d80ac..806b26b69 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -39,6 +39,7 @@ CAY-2788 DbImport: Add fallback option for the batch attribute loader
CAY-2795 Add unit tests for the Json type
CAY-2802 Upgrade Gradle to 7.6.1
CAY-2803 Test infrastructure: declarative custom DI modules in ServerCase
+CAY-2805 Stop calling exp parser internally
Bug Fixes:
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java b/cayenne-server/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
index 9d72ddcf3..7c1296346 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
@@ -161,7 +161,7 @@ class PrefetchProcessorJointNode extends PrefetchProcessorNode {
final String prefix;
if (jointRoot != this) {
- Expression objectPath = ExpressionFactory.exp(getPath(jointRoot));
+ Expression objectPath = ExpressionFactory.pathExp(getPath(jointRoot));
ASTPath translated = (ASTPath) ((PrefetchProcessorNode) jointRoot)
.getResolver()
.getEntity()
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/PrefetchNodeStage.java b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/PrefetchNodeStage.java
index 3aa795df1..924a6e916 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/PrefetchNodeStage.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/PrefetchNodeStage.java
@@ -77,7 +77,7 @@ class PrefetchNodeStage implements TranslationStage {
boolean warnPrefetchWithLimit = false;
for(PrefetchTreeNode node : prefetch.adjacentJointNodes()) {
- Expression prefetchExp = ExpressionFactory.exp(node.getPath());
+ Expression prefetchExp = ExpressionFactory.pathExp(node.getPath());
ASTDbPath dbPrefetch = (ASTDbPath) objEntity.translateToDbPath(prefetchExp);
final String dbPath = dbPrefetch.getPath();
DbEntity dbEntity = objEntity.getDbEntity();
@@ -124,10 +124,16 @@ class PrefetchNodeStage implements TranslationStage {
PathTranslator pathTranslator = context.getPathTranslator();
PrefetchSelectQuery<?> prefetchSelectQuery = (PrefetchSelectQuery<?>) select;
for(String prefetchPath: prefetchSelectQuery.getResultPaths()) {
- ASTDbPath pathExp = (ASTDbPath) context.getMetadata().getClassDescriptor().getEntity()
- .translateToDbPath(ExpressionFactory.exp(prefetchPath));
+ String path;
+ if(prefetchPath.startsWith(ASTDbPath.DB_PREFIX)) {
+ path = prefetchPath.substring(ASTDbPath.DB_PREFIX.length());
+ } else {
+ Expression exp = ExpressionFactory.pathExp(prefetchPath);
+ ASTDbPath pathExp = (ASTDbPath) context.getMetadata().getClassDescriptor().getEntity()
+ .translateToDbPath(exp);
+ path = pathExp.getPath();
+ }
- String path = pathExp.getPath();
PathTranslationResult result = pathTranslator
.translatePath(context.getMetadata().getDbEntity(), path);
result.getDbRelationship().ifPresent(r -> {