fix handling of @By("id(this)")
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
2955e0b91d
commit
e1bcd01321
|
@ -23,6 +23,9 @@ public interface SuperRepo<T,K> {
|
|||
@Find
|
||||
Optional<T> findById(@By("#id") K id);
|
||||
|
||||
@Find
|
||||
Optional<T> findById2(@By("id(this)") K id);
|
||||
|
||||
@Find
|
||||
Stream<T> findAll();
|
||||
|
||||
|
|
|
@ -1978,9 +1978,9 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
return null;
|
||||
}
|
||||
|
||||
private static boolean isIdRef(String nextToken) {
|
||||
return "#id".equals(nextToken) // for Jakarta Data M4 release
|
||||
|| "id(this)".equals(nextToken); // post M4
|
||||
private static boolean isIdRef(String token) {
|
||||
return "#id".equals(token) // for Jakarta Data M4 release
|
||||
|| "id(this)".equalsIgnoreCase(token); // post M4
|
||||
}
|
||||
|
||||
private @Nullable Element memberMatchingPath(
|
||||
|
@ -2593,7 +2593,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
.orElse("id");
|
||||
return method.getParameters().stream()
|
||||
.map(AnnotationMetaEntity::parameterName)
|
||||
.map(name -> "#id".equals(name) ? idName : name)
|
||||
.map(name -> isIdRef(name) ? idName : name)
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue