From 42d2f07e03f3862bfdb788c644db34efb6a3dae5 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sat, 6 Apr 2024 11:35:09 +0200 Subject: [PATCH] add a test and a comment Signed-off-by: Gavin King --- .../java/org/hibernate/processor/test/data/eg/Publishers.java | 4 ++++ .../hibernate/processor/annotation/AnnotationMetaEntity.java | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/eg/Publishers.java b/tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/eg/Publishers.java index 0532f019a1..7b1e1548ce 100644 --- a/tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/eg/Publishers.java +++ b/tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/eg/Publishers.java @@ -1,6 +1,7 @@ package org.hibernate.processor.test.data.eg; import jakarta.data.repository.BasicRepository; +import jakarta.data.repository.Find; import jakarta.data.repository.Query; import jakarta.data.repository.Repository; @@ -10,4 +11,7 @@ import java.util.stream.Stream; public interface Publishers extends BasicRepository { @Query(" ") Stream all(); + + @Find + Publisher find(Long id); } diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java index 3c321adf2c..6ae15c4a4f 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java @@ -1451,7 +1451,8 @@ public class AnnotationMetaEntity extends AnnotationMeta { } else { if ( containerType != null ) { - // multiple results, it has to be a criteria finder + // multiple results, so it has to be a criteria finder + // or, alternatively, Optional, which for now we treat similarly createCriteriaFinder( method, declaredType, containerType.toString(), entity ); } else {