From b7b6620015bfd87c4eff763bda28b293208f5700 Mon Sep 17 00:00:00 2001 From: Dario Date: Thu, 5 Dec 2024 14:52:57 +0100 Subject: [PATCH] fix return type --- build.gradle.kts | 2 +- .../en2do/mongodb/RepositoryInvocationHandler.java | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c2ebac6..767fa78 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "eu.koboo" -version = "1.2.9" +version = "1.3.0" repositories { mavenCentral() diff --git a/src/main/java/eu/koboo/en2do/mongodb/RepositoryInvocationHandler.java b/src/main/java/eu/koboo/en2do/mongodb/RepositoryInvocationHandler.java index faacbb7..c943c14 100644 --- a/src/main/java/eu/koboo/en2do/mongodb/RepositoryInvocationHandler.java +++ b/src/main/java/eu/koboo/en2do/mongodb/RepositoryInvocationHandler.java @@ -109,15 +109,7 @@ private Object executeMethod(IndexedMethod indexedMethod, Object[] arg case FILTER: findIterable = repositoryMeta.createIterable(Filters.and((Bson) arguments[arguments.length - 1], filter), methodName); - Long methodDefinedEntityCount = indexedMethod.getMethodDefinedEntityCount(); - if (methodDefinedEntityCount == -1 || methodDefinedEntityCount > 1) { - if (methodDefinedEntityCount != -1) { - findIterable = findIterable.limit(Math.toIntExact(methodDefinedEntityCount)); - } - return findIterable.into(new ArrayList<>()); - } else { - return findIterable.first(); - } + return findIterable.into(new ArrayList<>()); case FIND: findIterable = repositoryMeta.createIterable(filter, methodName); findIterable = repositoryMeta.applySortObject(method, findIterable, arguments); @@ -127,7 +119,7 @@ private Object executeMethod(IndexedMethod indexedMethod, Object[] arg // Many = -1 / unlimited // Top = specific count // First = 1 / first entity - methodDefinedEntityCount = indexedMethod.getMethodDefinedEntityCount(); + Long methodDefinedEntityCount = indexedMethod.getMethodDefinedEntityCount(); if (methodDefinedEntityCount == -1 || methodDefinedEntityCount > 1) { if (methodDefinedEntityCount != -1) { findIterable = findIterable.limit(Math.toIntExact(methodDefinedEntityCount));