From 8aca932fd621842013a6afb6186322eef9cfaa6e Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Mon, 8 Jun 2020 12:12:56 +0200 Subject: [PATCH] feat: dto with association --- .../java/io/micronaut/data/model/query/QueryModel.java | 2 +- .../visitors/finders/AbstractPatternBasedMethod.java | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/data-model/src/main/java/io/micronaut/data/model/query/QueryModel.java b/data-model/src/main/java/io/micronaut/data/model/query/QueryModel.java index dafe65a31c..07f98b03ac 100644 --- a/data-model/src/main/java/io/micronaut/data/model/query/QueryModel.java +++ b/data-model/src/main/java/io/micronaut/data/model/query/QueryModel.java @@ -1357,7 +1357,7 @@ public PropertyProjection(@Nullable String entityAlias, /** * - * @return The type the projected property belongs to + * @return The alias of the entity the property belongs to. */ @Nullable public String getEntityAlias() { diff --git a/data-processor/src/main/java/io/micronaut/data/processor/visitors/finders/AbstractPatternBasedMethod.java b/data-processor/src/main/java/io/micronaut/data/processor/visitors/finders/AbstractPatternBasedMethod.java index ef6134fea8..d52a275fe6 100644 --- a/data-processor/src/main/java/io/micronaut/data/processor/visitors/finders/AbstractPatternBasedMethod.java +++ b/data-processor/src/main/java/io/micronaut/data/processor/visitors/finders/AbstractPatternBasedMethod.java @@ -68,7 +68,6 @@ public abstract class AbstractPatternBasedMethod implements MethodCandidate { private static final String DELETE = "delete"; private static final String UPDATE = "update"; private static final String VOID = "void"; - private static final String ID = "id"; private static final Join.Type DEFAULT_JOIN_TYPE = Join.Type.FETCH; protected final Pattern pattern; @@ -205,10 +204,7 @@ protected MethodMatchInfo buildInfo( return null; } } - -// if (returnType.getSimpleName().equals("FaceDTO")) { -// applyJoinSpecifications(matchContext, query, matchContext.getRootEntity(), Arrays.asList(new JoinSpec("nose", "nose_", Join.Type.RIGHT_FETCH))); -// } + return new MethodMatchInfo(returnType, query, getInterceptorElement(matchContext, FindOneInterceptor.class), true); } else { @@ -521,7 +517,7 @@ private boolean attemptProjection(@NonNull MethodMatchContext matchContext, .findFirst(); if (associationOptional.isPresent()) { association = matchContext.getEntity(associationOptional.get().getType()); - pp = association.getIdOrVersionPropertyByName(ID); + pp = association.getIdentity(); } }