diff --git a/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java b/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java index 15740abcabe2a..8cc1c50404282 100644 --- a/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java +++ b/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java @@ -16,7 +16,6 @@ import io.quarkus.panache.common.Parameters; import io.quarkus.panache.common.Sort; import io.quarkus.panache.hibernate.common.runtime.PanacheJpaUtil; -import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; public abstract class AbstractJpaOperations { @@ -30,8 +29,6 @@ protected abstract PanacheQueryType createPanacheQuery(Uni sessi protected abstract Uni> list(PanacheQueryType query); - protected abstract Multi stream(PanacheQueryType query); - // // Instance methods @@ -177,30 +174,6 @@ public Uni> list(Class entityClass, String query, Sort sort, Paramete return list(find(entityClass, query, sort, params)); } - public Multi stream(Class entityClass, String query, Object... params) { - return stream(find(entityClass, query, params)); - } - - public Multi stream(Class entityClass, String query, Sort sort, Object... params) { - return stream(find(entityClass, query, sort, params)); - } - - public Multi stream(Class entityClass, String query, Map params) { - return stream(find(entityClass, query, params)); - } - - public Multi stream(Class entityClass, String query, Sort sort, Map params) { - return stream(find(entityClass, query, sort, params)); - } - - public Multi stream(Class entityClass, String query, Parameters params) { - return stream(find(entityClass, query, params)); - } - - public Multi stream(Class entityClass, String query, Sort sort, Parameters params) { - return stream(find(entityClass, query, sort, params)); - } - public PanacheQueryType findAll(Class entityClass) { String query = "FROM " + PanacheJpaUtil.getEntityName(entityClass); Uni session = getSession(); @@ -221,14 +194,6 @@ public Uni> listAll(Class entityClass, Sort sort) { return list(findAll(entityClass, sort)); } - public Multi streamAll(Class entityClass) { - return stream(findAll(entityClass)); - } - - public Multi streamAll(Class entityClass, Sort sort) { - return stream(findAll(entityClass, sort)); - } - @SuppressWarnings({ "rawtypes", "unchecked" }) public Uni count(Class entityClass) { return (Uni) getSession() diff --git a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheCompanion.kt b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheCompanion.kt index 6695a175fd064..302281d733c56 100644 --- a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheCompanion.kt +++ b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheCompanion.kt @@ -6,7 +6,6 @@ import io.quarkus.panache.common.Parameters import io.quarkus.panache.common.Sort import io.quarkus.panache.common.impl.GenerateBridge import io.smallrye.common.annotation.CheckReturnValue -import io.smallrye.mutiny.Multi import io.smallrye.mutiny.Uni import jakarta.persistence.LockModeType import org.hibernate.reactive.mutiny.Mutiny @@ -54,7 +53,6 @@ interface PanacheCompanionBase { * @param params optional sequence of indexed parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, vararg params: Any): PanacheQuery = injectionMissing() @@ -67,7 +65,6 @@ interface PanacheCompanionBase { * @param params optional sequence of indexed parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, sort: Sort, vararg params: Any): PanacheQuery = injectionMissing() @@ -79,7 +76,6 @@ interface PanacheCompanionBase { * @param params [Map] of named parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, params: Map): PanacheQuery = injectionMissing() @@ -92,7 +88,6 @@ interface PanacheCompanionBase { * @param params [Map] of indexed parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, sort: Sort, params: Map): PanacheQuery = injectionMissing() @@ -104,7 +99,6 @@ interface PanacheCompanionBase { * @param params [Parameters] of named parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, params: Parameters): PanacheQuery = injectionMissing() @@ -117,7 +111,6 @@ interface PanacheCompanionBase { * @param params [Parameters] of indexed parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, sort: Sort, params: Parameters): PanacheQuery = injectionMissing() @@ -127,7 +120,6 @@ interface PanacheCompanionBase { * * @return a new [PanacheQuery] instance to find all entities of this type. * @see [listAll] listAll - * @see [streamAll] streamAll */ @GenerateBridge fun findAll(): PanacheQuery = injectionMissing() @@ -138,7 +130,6 @@ interface PanacheCompanionBase { * @param sort the sort order to use * @return a new [PanacheQuery] instance to find all entities of this type. * @see [listAll] listAll - * @see [streamAll] streamAll */ @GenerateBridge fun findAll(sort: Sort): PanacheQuery = injectionMissing() @@ -151,7 +142,6 @@ interface PanacheCompanionBase { * @param params optional sequence of indexed parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -166,7 +156,6 @@ interface PanacheCompanionBase { * @param params optional sequence of indexed parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -180,7 +169,6 @@ interface PanacheCompanionBase { * @param params [Map] of named parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -195,7 +183,6 @@ interface PanacheCompanionBase { * @param params [Map] of indexed parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -209,7 +196,6 @@ interface PanacheCompanionBase { * @param params [Parameters] of named parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -224,7 +210,6 @@ interface PanacheCompanionBase { * @param params [Parameters] of indexed parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -236,7 +221,6 @@ interface PanacheCompanionBase { * * @return a [List] containing all results, without paging * @see [findAll] findAll - * @see [streamAll] streamAll */ @CheckReturnValue @GenerateBridge @@ -249,140 +233,11 @@ interface PanacheCompanionBase { * @param sort the sort order to use * @return a [List] containing all results, without paging * @see [findAll] findAll - * @see [streamAll] streamAll */ @CheckReturnValue @GenerateBridge fun listAll(sort: Sort): Uni> = injectionMissing() - /** - * Find entities matching a query, with optional indexed parameters. - * This method is a shortcut for `find(query, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param params optional sequence of indexed parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, vararg params: Any): Multi = injectionMissing() - - /** - * Find entities matching a query and the given sort options, with optional indexed parameters. - * This method is a shortcut for `find(query, sort, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param sort the sort strategy to use - * @param params optional sequence of indexed parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, sort: Sort, vararg params: Any): Multi = injectionMissing() - - /** - * Find entities matching a query, with named parameters. - * This method is a shortcut for `find(query, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param params [Map] of named parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, params: Map): Multi = injectionMissing() - - /** - * Find entities matching a query and the given sort options, with named parameters. - * This method is a shortcut for `find(query, sort, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param sort the sort strategy to use - * @param params [Map] of indexed parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, sort: Sort, params: Map): Multi = injectionMissing() - - /** - * Find entities matching a query, with named parameters. - * This method is a shortcut for `find(query, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param params [Parameters] of named parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, params: Parameters): Multi = injectionMissing() - - /** - * Find entities matching a query and the given sort options, with named parameters. - * This method is a shortcut for `find(query, sort, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param sort the sort strategy to use - * @param params [Parameters] of indexed parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, sort: Sort, params: Parameters): Multi = injectionMissing() - - /** - * Find all entities of this type. - * This method is a shortcut for `findAll().stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @return a [Stream] containing all results, without paging - * @see [findAll] findAll - * @see [listAll] listAll - */ - @CheckReturnValue - @GenerateBridge - fun streamAll(): Multi = injectionMissing() - - /** - * Find all entities of this type, in the given order. - * This method is a shortcut for `findAll(sort).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param sort the sort order to use - * @return a [Stream] containing all results, without paging - * @see [findAll] findAll - * @see [listAll] listAll - */ - @CheckReturnValue - @GenerateBridge - fun streamAll(sort: Sort): Multi = injectionMissing() - /** * Counts the number of this type of entity in the database. * diff --git a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheQuery.kt b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheQuery.kt index 9db3027c9394d..246cb7850c157 100644 --- a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheQuery.kt +++ b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheQuery.kt @@ -3,7 +3,6 @@ package io.quarkus.hibernate.reactive.panache.kotlin import io.quarkus.panache.common.Page import io.quarkus.panache.common.Parameters import io.smallrye.common.annotation.CheckReturnValue -import io.smallrye.mutiny.Multi import io.smallrye.mutiny.Uni import jakarta.persistence.LockModeType import jakarta.persistence.NonUniqueResultException @@ -208,22 +207,11 @@ interface PanacheQuery { * Returns the current page of results as a [List]. * * @return the current page of results as a [List]. - * @see [PanacheQuery.stream] * @see [PanacheQuery.page] */ @CheckReturnValue fun list(): Uni> - /** - * Returns the current page of results as a Stream. - * - * @return the current page of results as a Stream. - * @see [PanacheQuery.list] - * @see [PanacheQuery.page] - */ - @CheckReturnValue - fun stream(): Multi - /** * Returns the first result of the current page index. This ignores the current page size to fetch * a single result. diff --git a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheRepositoryBase.kt b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheRepositoryBase.kt index 3937b2b79a99b..0ca8dd2cb37e0 100644 --- a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheRepositoryBase.kt +++ b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/PanacheRepositoryBase.kt @@ -6,7 +6,6 @@ import io.quarkus.panache.common.Parameters import io.quarkus.panache.common.Sort import io.quarkus.panache.common.impl.GenerateBridge import io.smallrye.common.annotation.CheckReturnValue -import io.smallrye.mutiny.Multi import io.smallrye.mutiny.Uni import jakarta.persistence.LockModeType import org.hibernate.reactive.mutiny.Mutiny @@ -105,7 +104,6 @@ interface PanacheRepositoryBase { * @param params optional sequence of indexed parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, vararg params: Any): PanacheQuery = throw INSTANCE.implementationInjectionMissing() @@ -118,7 +116,6 @@ interface PanacheRepositoryBase { * @param params optional sequence of indexed parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, sort: Sort, vararg params: Any): PanacheQuery = @@ -131,7 +128,6 @@ interface PanacheRepositoryBase { * @param params [Map] of named parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, params: Map): PanacheQuery = @@ -145,7 +141,6 @@ interface PanacheRepositoryBase { * @param params [Map] of indexed parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, sort: Sort, params: Map): PanacheQuery = @@ -158,7 +153,6 @@ interface PanacheRepositoryBase { * @param params [Parameters] of named parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, params: Parameters): PanacheQuery = throw INSTANCE.implementationInjectionMissing() @@ -171,7 +165,6 @@ interface PanacheRepositoryBase { * @param params [Parameters] of indexed parameters * @return a new [PanacheQuery] instance for the given query * @see [list] list - * @see [stream] stream */ @GenerateBridge fun find(query: String, sort: Sort, params: Parameters): PanacheQuery = @@ -182,7 +175,6 @@ interface PanacheRepositoryBase { * * @return a new [PanacheQuery] instance to find all entities of this type. * @see [listAll] listAll - * @see [streamAll] streamAll */ @GenerateBridge fun findAll(): PanacheQuery = throw INSTANCE.implementationInjectionMissing() @@ -193,7 +185,6 @@ interface PanacheRepositoryBase { * @param sort the sort order to use * @return a new [PanacheQuery] instance to find all entities of this type. * @see [listAll] listAll - * @see [streamAll] streamAll */ @GenerateBridge fun findAll(sort: Sort): PanacheQuery = throw INSTANCE.implementationInjectionMissing() @@ -206,7 +197,6 @@ interface PanacheRepositoryBase { * @param params optional sequence of indexed parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -221,7 +211,6 @@ interface PanacheRepositoryBase { * @param params optional sequence of indexed parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -236,7 +225,6 @@ interface PanacheRepositoryBase { * @param params [Map] of named parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -252,7 +240,6 @@ interface PanacheRepositoryBase { * @param params [Map] of indexed parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -267,7 +254,6 @@ interface PanacheRepositoryBase { * @param params [Parameters] of named parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -282,7 +268,6 @@ interface PanacheRepositoryBase { * @param params [Parameters] of indexed parameters * @return a [List] containing all results, without paging * @see [find] find - * @see [stream] stream */ @CheckReturnValue @GenerateBridge @@ -295,7 +280,6 @@ interface PanacheRepositoryBase { * * @return a [List] containing all results, without paging * @see [findAll] findAll - * @see [streamAll] streamAll */ @CheckReturnValue @GenerateBridge @@ -310,144 +294,11 @@ interface PanacheRepositoryBase { * @param sort the sort order to use * @return a [List] containing all results, without paging * @see [findAll] findAll - * @see [streamAll] streamAll */ @CheckReturnValue @GenerateBridge fun listAll(sort: Sort): Uni> = throw INSTANCE.implementationInjectionMissing() - /** - * Find entities matching a query, with optional indexed parameters. - * This method is a shortcut for `find(query, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param params optional sequence of indexed parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, vararg params: Any): Multi = throw INSTANCE.implementationInjectionMissing() - - /** - * Find entities matching a query and the given sort options, with optional indexed parameters. - * This method is a shortcut for `find(query, sort, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param sort the sort strategy to use - * @param params optional sequence of indexed parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, sort: Sort, vararg params: Any): Multi = - throw INSTANCE.implementationInjectionMissing() - - /** - * Find entities matching a query, with named parameters. - * This method is a shortcut for `find(query, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param params [Map] of named parameters - * @return a [Stream] containing all results, without paging - * @see [stream] stream - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, params: Map): Multi = - throw INSTANCE.implementationInjectionMissing() - - /** - * Find entities matching a query and the given sort options, with named parameters. - * This method is a shortcut for `find(query, sort, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param sort the sort strategy to use - * @param params [Map] of indexed parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, sort: Sort, params: Map): Multi = - throw INSTANCE.implementationInjectionMissing() - - /** - * Find entities matching a query, with named parameters. - * This method is a shortcut for `find(query, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param params [Parameters] of named parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, params: Parameters): Multi = throw INSTANCE.implementationInjectionMissing() - - /** - * Find entities matching a query and the given sort options, with named parameters. - * This method is a shortcut for `find(query, sort, params).stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a query string - * @param sort the sort strategy to use - * @param params [Parameters] of indexed parameters - * @return a [Stream] containing all results, without paging - * @see [find] find - * @see [list] list - */ - @CheckReturnValue - @GenerateBridge - fun stream(query: String, sort: Sort, params: Parameters): Multi = - throw INSTANCE.implementationInjectionMissing() - - /** - * Find all entities of this type. - * This method is a shortcut for `findAll().stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @return a [Stream] containing all results, without paging - * @see [findAll] findAll - * @see [listAll] listAll - */ - @CheckReturnValue - @GenerateBridge - fun streamAll(sort: Sort): Multi = throw INSTANCE.implementationInjectionMissing() - - /** - * Find all entities of this type, in the given order. - * This method is a shortcut for `findAll().stream()`. - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @return a [Stream] containing all results, without paging - * @see [findAll] findAll - * @see [listAll] listAll - */ - @CheckReturnValue - @GenerateBridge - fun streamAll(): Multi = throw INSTANCE.implementationInjectionMissing() - /** * Counts the number of this type of entity in the database. * diff --git a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/runtime/KotlinJpaOperations.kt b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/runtime/KotlinJpaOperations.kt index 4fe81ea2068b1..cee34a7b17273 100644 --- a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/runtime/KotlinJpaOperations.kt +++ b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/runtime/KotlinJpaOperations.kt @@ -1,7 +1,6 @@ package io.quarkus.hibernate.reactive.panache.kotlin.runtime import io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations -import io.smallrye.mutiny.Multi import io.smallrye.mutiny.Uni import org.hibernate.reactive.mutiny.Mutiny @@ -11,8 +10,6 @@ class KotlinJpaOperations : AbstractJpaOperations>() { override fun list(query: PanacheQueryImpl<*>): Uni> = query.list() as Uni> - override fun stream(query: PanacheQueryImpl<*>): Multi<*> = query.stream() - companion object { /** * Provides the default implementations for quarkus to wire up. Should not be used by third party developers. diff --git a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/runtime/PanacheQueryImpl.kt b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/runtime/PanacheQueryImpl.kt index 1d3ea5269d02c..0db700c637127 100644 --- a/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/runtime/PanacheQueryImpl.kt +++ b/extensions/panache/hibernate-reactive-panache-kotlin/runtime/src/main/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/runtime/PanacheQueryImpl.kt @@ -4,7 +4,6 @@ import io.quarkus.hibernate.reactive.panache.common.runtime.CommonPanacheQueryIm import io.quarkus.hibernate.reactive.panache.kotlin.PanacheQuery import io.quarkus.panache.common.Page import io.quarkus.panache.common.Parameters -import io.smallrye.mutiny.Multi import io.smallrye.mutiny.Uni import jakarta.persistence.LockModeType import org.hibernate.reactive.mutiny.Mutiny @@ -105,8 +104,6 @@ class PanacheQueryImpl : PanacheQuery { override fun list(): Uni> = delegate.list() - override fun stream(): Multi = delegate.stream() - override fun firstResult(): Uni = delegate.firstResult() override fun singleResult(): Uni = delegate.singleResult() diff --git a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheEntityBase.java b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheEntityBase.java index 54ae5299fd740..33fb883467b0e 100644 --- a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheEntityBase.java +++ b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheEntityBase.java @@ -18,7 +18,6 @@ import io.quarkus.panache.common.Sort; import io.quarkus.panache.common.impl.GenerateBridge; import io.smallrye.common.annotation.CheckReturnValue; -import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; /** @@ -422,170 +421,6 @@ public static Uni> listAll(Sort sort) { throw INSTANCE.implementationInjectionMissing(); } - /** - * Find entities matching a query, with optional indexed parameters. - * This method is a shortcut for find(query, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param params optional sequence of indexed parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Sort, Object...) - * @see #stream(String, Map) - * @see #stream(String, Parameters) - * @see #find(String, Object...) - * @see #list(String, Object...) - */ - @CheckReturnValue - @GenerateBridge - public static Multi stream(String query, Object... params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query and the given sort options, with optional indexed parameters. - * This method is a shortcut for find(query, sort, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param sort the sort strategy to use - * @param params optional sequence of indexed parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Object...) - * @see #stream(String, Sort, Map) - * @see #stream(String, Sort, Parameters) - * @see #find(String, Sort, Object...) - * @see #list(String, Sort, Object...) - */ - @CheckReturnValue - @GenerateBridge - public static Multi stream(String query, Sort sort, Object... params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query, with named parameters. - * This method is a shortcut for find(query, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param params {@link Map} of named parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Sort, Map) - * @see #stream(String, Object...) - * @see #stream(String, Parameters) - * @see #find(String, Map) - * @see #list(String, Map) - */ - @CheckReturnValue - @GenerateBridge - public static Multi stream(String query, Map params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query and the given sort options, with named parameters. - * This method is a shortcut for find(query, sort, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param sort the sort strategy to use - * @param params {@link Map} of indexed parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Map) - * @see #stream(String, Sort, Object...) - * @see #stream(String, Sort, Parameters) - * @see #find(String, Sort, Map) - * @see #list(String, Sort, Map) - */ - @CheckReturnValue - @GenerateBridge - public static Multi stream(String query, Sort sort, Map params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query, with named parameters. - * This method is a shortcut for find(query, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param params {@link Parameters} of named parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Sort, Parameters) - * @see #stream(String, Object...) - * @see #stream(String, Map) - * @see #find(String, Parameters) - * @see #list(String, Parameters) - */ - @CheckReturnValue - @GenerateBridge - public static Multi stream(String query, Parameters params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query and the given sort options, with named parameters. - * This method is a shortcut for find(query, sort, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param sort the sort strategy to use - * @param params {@link Parameters} of indexed parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Parameters) - * @see #stream(String, Sort, Object...) - * @see #stream(String, Sort, Map) - * @see #find(String, Sort, Parameters) - * @see #list(String, Sort, Parameters) - */ - @CheckReturnValue - @GenerateBridge - public static Multi stream(String query, Sort sort, Parameters params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find all entities of this type. - * This method is a shortcut for findAll().stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @return a {@link Stream} containing all results, without paging - * @see #streamAll(Sort) - * @see #findAll() - * @see #listAll() - */ - @CheckReturnValue - @GenerateBridge - public static Multi streamAll() { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find all entities of this type, in the given order. - * This method is a shortcut for findAll(sort).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param sort the sort order to use - * @return a {@link Stream} containing all results, without paging - * @see #streamAll() - * @see #findAll(Sort) - * @see #listAll(Sort) - */ - @CheckReturnValue - @GenerateBridge - public static Multi streamAll(Sort sort) { - throw INSTANCE.implementationInjectionMissing(); - } - /** * Counts the number of this type of entity in the database. * diff --git a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheQuery.java b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheQuery.java index 515e26fcd3675..7ce81efb0a749 100644 --- a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheQuery.java +++ b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheQuery.java @@ -2,7 +2,6 @@ import java.util.List; import java.util.Map; -import java.util.stream.Stream; import jakarta.persistence.LockModeType; import jakarta.persistence.NoResultException; @@ -14,13 +13,12 @@ import io.quarkus.panache.common.Page; import io.quarkus.panache.common.Parameters; import io.smallrye.common.annotation.CheckReturnValue; -import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; /** *

* Interface representing an entity query, which abstracts the use of paging, getting the number of results, and - * operating on {@link List} or {@link Stream}. + * operating on {@link List}. *

*

* Instances of this interface cannot mutate the query itself or its parameters: only paging information can be @@ -232,24 +230,12 @@ public interface PanacheQuery { * Returns the current page of results as a {@link List}. * * @return the current page of results as a {@link List}. - * @see #stream() * @see #page(Page) * @see #page() */ @CheckReturnValue public Uni> list(); - /** - * Returns the current page of results as a {@link Stream}. - * - * @return the current page of results as a {@link Stream}. - * @see #list() - * @see #page(Page) - * @see #page() - */ - @CheckReturnValue - public Multi stream(); - /** * Returns the first result of the current page index. This ignores the current page size to fetch * a single result. diff --git a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheRepositoryBase.java b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheRepositoryBase.java index 46a696fcbcb31..0d8f7db73363e 100644 --- a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheRepositoryBase.java +++ b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheRepositoryBase.java @@ -14,7 +14,6 @@ import io.quarkus.panache.common.Sort; import io.quarkus.panache.common.impl.GenerateBridge; import io.smallrye.common.annotation.CheckReturnValue; -import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; /** @@ -148,7 +147,6 @@ public default Uni findById(Id id, LockModeType lockModeType) { * @see #find(String, Map) * @see #find(String, Parameters) * @see #list(String, Object...) - * @see #stream(String, Object...) */ @GenerateBridge public default PanacheQuery find(String query, Object... params) { @@ -166,7 +164,6 @@ public default PanacheQuery find(String query, Object... params) { * @see #find(String, Sort, Map) * @see #find(String, Sort, Parameters) * @see #list(String, Sort, Object...) - * @see #stream(String, Sort, Object...) */ @GenerateBridge public default PanacheQuery find(String query, Sort sort, Object... params) { @@ -183,7 +180,6 @@ public default PanacheQuery find(String query, Sort sort, Object... para * @see #find(String, Object...) * @see #find(String, Parameters) * @see #list(String, Map) - * @see #stream(String, Map) */ @GenerateBridge public default PanacheQuery find(String query, Map params) { @@ -201,7 +197,6 @@ public default PanacheQuery find(String query, Map param * @see #find(String, Sort, Object...) * @see #find(String, Sort, Parameters) * @see #list(String, Sort, Map) - * @see #stream(String, Sort, Map) */ @GenerateBridge public default PanacheQuery find(String query, Sort sort, Map params) { @@ -218,7 +213,6 @@ public default PanacheQuery find(String query, Sort sort, Map find(String query, Parameters params) { @@ -236,7 +230,6 @@ public default PanacheQuery find(String query, Parameters params) { * @see #find(String, Sort, Map) * @see #find(String, Sort, Parameters) * @see #list(String, Sort, Parameters) - * @see #stream(String, Sort, Parameters) */ @GenerateBridge public default PanacheQuery find(String query, Sort sort, Parameters params) { @@ -249,7 +242,6 @@ public default PanacheQuery find(String query, Sort sort, Parameters par * @return a new {@link PanacheQuery} instance to find all entities of this type. * @see #findAll(Sort) * @see #listAll() - * @see #streamAll() */ @GenerateBridge public default PanacheQuery findAll() { @@ -263,7 +255,6 @@ public default PanacheQuery findAll() { * @return a new {@link PanacheQuery} instance to find all entities of this type. * @see #findAll() * @see #listAll(Sort) - * @see #streamAll(Sort) */ @GenerateBridge public default PanacheQuery findAll(Sort sort) { @@ -281,7 +272,6 @@ public default PanacheQuery findAll(Sort sort) { * @see #list(String, Map) * @see #list(String, Parameters) * @see #find(String, Object...) - * @see #stream(String, Object...) */ @CheckReturnValue @GenerateBridge @@ -301,7 +291,6 @@ public default Uni> list(String query, Object... params) { * @see #list(String, Sort, Map) * @see #list(String, Sort, Parameters) * @see #find(String, Sort, Object...) - * @see #stream(String, Sort, Object...) */ @CheckReturnValue @GenerateBridge @@ -320,7 +309,6 @@ public default Uni> list(String query, Sort sort, Object... params) * @see #list(String, Object...) * @see #list(String, Parameters) * @see #find(String, Map) - * @see #stream(String, Map) */ @CheckReturnValue @GenerateBridge @@ -340,7 +328,6 @@ public default Uni> list(String query, Map params) * @see #list(String, Sort, Object...) * @see #list(String, Sort, Parameters) * @see #find(String, Sort, Map) - * @see #stream(String, Sort, Map) */ @CheckReturnValue @GenerateBridge @@ -359,7 +346,6 @@ public default Uni> list(String query, Sort sort, Map> list(String query, Parameters params) { * @see #list(String, Sort, Object...) * @see #list(String, Sort, Map) * @see #find(String, Sort, Parameters) - * @see #stream(String, Sort, Parameters) */ @CheckReturnValue @GenerateBridge @@ -394,7 +379,6 @@ public default Uni> list(String query, Sort sort, Parameters params * @return a {@link List} containing all results, without paging * @see #listAll(Sort) * @see #findAll() - * @see #streamAll() */ @CheckReturnValue @GenerateBridge @@ -410,7 +394,6 @@ public default Uni> listAll() { * @return a {@link List} containing all results, without paging * @see #listAll() * @see #findAll(Sort) - * @see #streamAll(Sort) */ @CheckReturnValue @GenerateBridge @@ -418,169 +401,6 @@ public default Uni> listAll(Sort sort) { throw INSTANCE.implementationInjectionMissing(); } - /** - * Find entities matching a query, with optional indexed parameters. - * This method is a shortcut for find(query, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param params optional sequence of indexed parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Sort, Object...) - * @see #stream(String, Map) - * @see #stream(String, Parameters) - * @see #find(String, Object...) - * @see #list(String, Object...) - */ - @CheckReturnValue - @GenerateBridge - public default Multi stream(String query, Object... params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query and the given sort options, with optional indexed parameters. - * This method is a shortcut for find(query, sort, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param sort the sort strategy to use - * @param params optional sequence of indexed parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Object...) - * @see #stream(String, Sort, Map) - * @see #stream(String, Sort, Parameters) - * @see #find(String, Sort, Object...) - * @see #list(String, Sort, Object...) - */ - @CheckReturnValue - @GenerateBridge - public default Multi stream(String query, Sort sort, Object... params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query, with named parameters. - * This method is a shortcut for find(query, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param params {@link Map} of named parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Sort, Map) - * @see #stream(String, Object...) - * @see #stream(String, Parameters) - * @see #find(String, Map) - * @see #list(String, Map) - */ - @CheckReturnValue - @GenerateBridge - public default Multi stream(String query, Map params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query and the given sort options, with named parameters. - * This method is a shortcut for find(query, sort, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param sort the sort strategy to use - * @param params {@link Map} of indexed parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Map) - * @see #stream(String, Sort, Object...) - * @see #stream(String, Sort, Parameters) - * @see #find(String, Sort, Map) - * @see #list(String, Sort, Map) - */ - @CheckReturnValue - @GenerateBridge - public default Multi stream(String query, Sort sort, Map params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query, with named parameters. - * This method is a shortcut for find(query, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param params {@link Parameters} of named parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Sort, Parameters) - * @see #stream(String, Object...) - * @see #stream(String, Map) - * @see #find(String, Parameters) - * @see #list(String, Parameters) - */ - @CheckReturnValue - @GenerateBridge - public default Multi stream(String query, Parameters params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find entities matching a query and the given sort options, with named parameters. - * This method is a shortcut for find(query, sort, params).stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @param query a {@link io.quarkus.hibernate.reactive.panache query string} - * @param sort the sort strategy to use - * @param params {@link Parameters} of indexed parameters - * @return a {@link Stream} containing all results, without paging - * @see #stream(String, Parameters) - * @see #stream(String, Sort, Object...) - * @see #stream(String, Sort, Map) - * @see #find(String, Sort, Parameters) - * @see #list(String, Sort, Parameters) - */ - @CheckReturnValue - @GenerateBridge - public default Multi stream(String query, Sort sort, Parameters params) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find all entities of this type. - * This method is a shortcut for findAll().stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @return a {@link Stream} containing all results, without paging - * @see #streamAll(Sort) - * @see #findAll() - * @see #listAll() - */ - @CheckReturnValue - @GenerateBridge - public default Multi streamAll(Sort sort) { - throw INSTANCE.implementationInjectionMissing(); - } - - /** - * Find all entities of this type, in the given order. - * This method is a shortcut for findAll().stream(). - * It requires a transaction to work. - * Without a transaction, the underlying cursor can be closed before the end of the stream. - * - * @return a {@link Stream} containing all results, without paging - * @see #streamAll() - * @see #findAll(Sort) - * @see #listAll(Sort) - */ - @CheckReturnValue - @GenerateBridge - public default Multi streamAll() { - throw INSTANCE.implementationInjectionMissing(); - } - /** * Counts the number of this type of entity in the database. * diff --git a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/runtime/JpaOperations.java b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/runtime/JpaOperations.java index cb97ea3527e79..bc671a43c83aa 100644 --- a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/runtime/JpaOperations.java +++ b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/runtime/JpaOperations.java @@ -5,10 +5,10 @@ import org.hibernate.reactive.mutiny.Mutiny; import io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations; -import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; public class JpaOperations extends AbstractJpaOperations> { + public static final JpaOperations INSTANCE = new JpaOperations(); @Override @@ -23,8 +23,4 @@ protected Uni> list(PanacheQueryImpl query) { return (Uni) query.list(); } - @Override - protected Multi stream(PanacheQueryImpl query) { - return query.stream(); - } } diff --git a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/runtime/PanacheQueryImpl.java b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/runtime/PanacheQueryImpl.java index 8f69bbb1a2f7f..6ae96e94c5a02 100644 --- a/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/runtime/PanacheQueryImpl.java +++ b/extensions/panache/hibernate-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/runtime/PanacheQueryImpl.java @@ -12,7 +12,6 @@ import io.quarkus.hibernate.reactive.panache.common.runtime.CommonPanacheQueryImpl; import io.quarkus.panache.common.Page; import io.quarkus.panache.common.Parameters; -import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; public class PanacheQueryImpl implements PanacheQuery { @@ -149,11 +148,6 @@ public Uni> list() { return delegate.list(); } - @Override - public Multi stream() { - return delegate.stream(); - } - @Override public Uni firstResult() { return delegate.firstResult(); diff --git a/integration-tests/hibernate-reactive-panache-kotlin/src/main/kotlin/io/quarkus/it/panache/reactive/kotlin/TestEndpoint.kt b/integration-tests/hibernate-reactive-panache-kotlin/src/main/kotlin/io/quarkus/it/panache/reactive/kotlin/TestEndpoint.kt index f0cfc823de404..1f7431fe74212 100644 --- a/integration-tests/hibernate-reactive-panache-kotlin/src/main/kotlin/io/quarkus/it/panache/reactive/kotlin/TestEndpoint.kt +++ b/integration-tests/hibernate-reactive-panache-kotlin/src/main/kotlin/io/quarkus/it/panache/reactive/kotlin/TestEndpoint.kt @@ -174,10 +174,6 @@ class TestEndpoint { .flatMap { count -> assertEquals(1, count) query.list() - }.flatMap { list -> - assertEquals(1, list.size) - assertEquals(livePerson, list[0]) - query.stream().collect().asList() }.flatMap { list -> assertEquals(1, list.size) query.firstResult() @@ -252,12 +248,6 @@ class TestEndpoint { Person.listAll() }.flatMap { persons -> assertEquals(0, persons.size) - Person.findAll().stream().collect().asList() - }.flatMap { personStream -> - assertEquals(0, personStream.size) - Person.streamAll().collect().asList() - }.flatMap { personStream -> - assertEquals(0, personStream.size) assertThrows(NoResultException::class.java) { Person.findAll().singleResult() } @@ -292,14 +282,6 @@ class TestEndpoint { assertEquals(1, persons.size) assertEquals(person, persons[0]) Person.listAll() - }.flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - Person.findAll().stream().collect().asList() - }.flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - Person.streamAll().collect().asList() }.flatMap { persons -> assertEquals(1, persons.size) assertEquals(person, persons[0]) @@ -347,26 +329,6 @@ class TestEndpoint { assertEquals(1, persons.size) assertEquals(person, persons[0]) Person.find("name", "stef").list() - }.flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - Person.find("name = ?1", "stef").stream().collect().asList() - }.flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - Person.stream("name = ?1", "stef").collect().asList() - }.flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - Person.stream("name = :name", with("name", "stef").map()).collect().asList() - }.flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - Person.stream("name = :name", with("name", "stef")).collect().asList() - }.flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - Person.find("name", "stef").stream().collect().asList() }.flatMap { persons -> assertEquals(1, persons.size) assertEquals(person, persons[0]) @@ -725,12 +687,6 @@ class TestEndpoint { personDao.listAll() }.flatMap { persons -> assertEquals(0, persons.size) - personDao.findAll().stream().collect().asList() - }.flatMap { personStream -> - assertEquals(0, personStream.size) - personDao.streamAll().collect().asList() - }.flatMap { personStream -> - assertEquals(0, personStream.size) assertThrows(NoResultException::class.java) { personDao.findAll().singleResult() } @@ -774,17 +730,6 @@ class TestEndpoint { assertEquals(person, persons[0]) personDao.listAll() } - .flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - personDao.findAll().stream() - .collect().asList() - } - .flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - personDao.streamAll().collect().asList() - } .flatMap { persons -> assertEquals(1, persons.size) assertEquals(person, persons[0]) @@ -842,35 +787,6 @@ class TestEndpoint { assertEquals(person, persons[0]) personDao.find("name", "stef").list() } - .flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - personDao.find("name = ?1", "stef").stream() - .collect().asList() - } - .flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - personDao.stream("name = ?1", "stef").collect().asList() - } - .flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - personDao.stream("name = :name", with("name", "stef").map()) - .collect().asList() - } - .flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - personDao.stream("name = :name", with("name", "stef")) - .collect().asList() - } - .flatMap { persons -> - assertEquals(1, persons.size) - assertEquals(person, persons[0]) - personDao.find("name", "stef").stream() - .collect().asList() - } .flatMap { persons -> assertEquals(1, persons.size) assertEquals(person, persons[0]) @@ -1271,18 +1187,12 @@ class TestEndpoint { .flatMap { list -> assertEquals(order1, list) Person.listAll(sort1) - }.flatMap { list -> - assertEquals(order1, list) - Person.streamAll(sort1).collect().asList() }.flatMap { list -> assertEquals(order1, list) Person.find("name", sort2, "stef").list() }.flatMap { list -> assertEquals(order2, list) Person.list("name", sort2, "stef") - }.flatMap { list -> - assertEquals(order2, list) - Person.stream("name", sort2, "stef").collect().asList() }.flatMap { list -> assertEquals(order2, list) Person.find("name = :name", sort2, with("name", "stef").map()) @@ -1290,20 +1200,12 @@ class TestEndpoint { }.flatMap { list -> assertEquals(order2, list) Person.list("name = :name", sort2, with("name", "stef").map()) - }.flatMap { list -> - assertEquals(order2, list) - Person.stream("name = :name", sort2, with("name", "stef").map()) - .collect().asList() }.flatMap { list -> assertEquals(order2, list) Person.find("name = :name", sort2, with("name", "stef")).list() }.flatMap { list -> assertEquals(order2, list) Person.list("name = :name", sort2, with("name", "stef")) - }.flatMap { list -> - assertEquals(order2, list) - Person.stream("name = :name", sort2, with("name", "stef")) - .collect().asList() } }.flatMap { Person.deleteAll() } .map { count -> diff --git a/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java b/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java index e6c54a13562ae..926c9dd2d87c3 100644 --- a/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java +++ b/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java @@ -23,12 +23,12 @@ import io.quarkus.hibernate.reactive.panache.Panache; import io.quarkus.hibernate.reactive.panache.PanacheQuery; +import io.quarkus.hibernate.reactive.panache.common.WithTransaction; import io.quarkus.hibernate.reactive.panache.common.runtime.ReactiveTransactional; import io.quarkus.panache.common.Page; import io.quarkus.panache.common.Parameters; import io.quarkus.panache.common.Sort; import io.quarkus.panache.common.exception.PanacheQueryException; -import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; /** @@ -48,19 +48,9 @@ public Uni testModel() { return Person.findAll().list() .flatMap(persons -> { Assertions.assertEquals(0, persons.size()); - return Person.listAll(); }).flatMap(persons -> { Assertions.assertEquals(0, persons.size()); - - return collect(Person.findAll().stream()); - }).flatMap(personStream -> { - Assertions.assertEquals(0, personStream.size()); - - return collect(Person.streamAll()); - }).flatMap(personStream -> { - - Assertions.assertEquals(0, personStream.size()); return assertThrows(NoResultException.class, () -> Person.findAll().singleResult(), "singleResult should have thrown"); }).flatMap(v -> Person.findAll().firstResult()) @@ -102,16 +92,6 @@ public Uni testModel() { Assertions.assertEquals(1, persons.size()); Assertions.assertEquals(person, persons.get(0)); - return collect(Person.findAll().stream()); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(Person.streamAll()); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - return Person.findAll().firstResult(); }).flatMap(personResult -> { Assertions.assertEquals(person, personResult); @@ -178,31 +158,6 @@ public Uni testModel() { Assertions.assertEquals(1, persons.size()); Assertions.assertEquals(person, persons.get(0)); - return collect(Person.find("name = ?1", "stef").stream()); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(Person.stream("name = ?1", "stef")); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(Person.stream("name = :name", Parameters.with("name", "stef").map())); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(Person.stream("name = :name", Parameters.with("name", "stef"))); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(Person.find("name", "stef").stream()); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - return Person.find("name", "stef").firstResult(); }).flatMap(personResult -> { Assertions.assertEquals(person, personResult); @@ -415,10 +370,6 @@ public Uni testModel() { .map(v -> "OK"); } - private Uni> collect(Multi stream) { - return stream.collect().asList(); - } - private Uni testUpdate() { return makeSavedPerson("p1") .flatMap(v -> makeSavedPerson("p2")) @@ -636,10 +587,6 @@ private Uni testSorting() { }).flatMap(list -> { Assertions.assertEquals(order1, list); - return collect(Person. streamAll(sort1)); - }).flatMap(list -> { - Assertions.assertEquals(order1, list); - return Person.find("name", sort2, "stef").list(); }).flatMap(list -> { Assertions.assertEquals(order2, list); @@ -648,10 +595,6 @@ private Uni testSorting() { }).flatMap(list -> { Assertions.assertEquals(order2, list); - return collect(Person. stream("name", sort2, "stef")); - }).flatMap(list -> { - Assertions.assertEquals(order2, list); - return Person.find("name = :name", sort2, Parameters.with("name", "stef").map()).list(); }).flatMap(list -> { Assertions.assertEquals(order2, list); @@ -660,20 +603,11 @@ private Uni testSorting() { }).flatMap(list -> { Assertions.assertEquals(order2, list); - return collect( - Person. stream("name = :name", sort2, Parameters.with("name", "stef").map())); - }).flatMap(list -> { - Assertions.assertEquals(order2, list); - return Person.find("name = :name", sort2, Parameters.with("name", "stef")).list(); }).flatMap(list -> { Assertions.assertEquals(order2, list); return Person.list("name = :name", sort2, Parameters.with("name", "stef")); - }).flatMap(list -> { - Assertions.assertEquals(order2, list); - - return collect(Person. stream("name = :name", sort2, Parameters.with("name", "stef"))); }); }).flatMap(v -> Person.deleteAll()) .map(count -> { @@ -792,7 +726,7 @@ private Uni testPersistDao(PersistTest persistTest) { @Inject NamedQueryWith2QueriesRepository namedQueryWith2QueriesRepository; - @ReactiveTransactional + @WithTransaction @GET @Path("model-dao") public Uni testModelDao() { @@ -802,16 +736,8 @@ public Uni testModelDao() { return personDao.listAll(); }).flatMap(persons -> { - Assertions.assertEquals(0, persons.size()); - - return collect(personDao.findAll().stream()); - }).flatMap(personStream -> { - Assertions.assertEquals(0, personStream.size()); - - return collect(personDao.streamAll()); - }).flatMap(personStream -> { - Assertions.assertEquals(0, personStream.size()); + Assertions.assertEquals(0, persons.size()); return assertThrows(NoResultException.class, () -> personDao.findAll().singleResult(), "singleResult should have thrown"); }).flatMap(v -> personDao.findAll().firstResult()) @@ -853,16 +779,6 @@ public Uni testModelDao() { Assertions.assertEquals(1, persons.size()); Assertions.assertEquals(person, persons.get(0)); - return collect(personDao.findAll().stream()); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(personDao.streamAll()); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - return personDao.findAll().firstResult(); }).flatMap(personResult -> { Assertions.assertEquals(person, personResult); @@ -923,31 +839,6 @@ public Uni testModelDao() { Assertions.assertEquals(1, persons.size()); Assertions.assertEquals(person, persons.get(0)); - return collect(personDao.find("name = ?1", "stef").stream()); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(personDao.stream("name = ?1", "stef")); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(personDao.stream("name = :name", Parameters.with("name", "stef").map())); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(personDao.stream("name = :name", Parameters.with("name", "stef"))); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - - return collect(personDao.find("name", "stef").stream()); - }).flatMap(persons -> { - Assertions.assertEquals(1, persons.size()); - Assertions.assertEquals(person, persons.get(0)); - return personDao.find("name", "stef").firstResult(); }).flatMap(personResult -> { Assertions.assertEquals(person, personResult); @@ -1517,7 +1408,7 @@ private void checkMethod(Class klass, String name, Class returnType, Class Assertions.assertEquals(returnType, method.getReturnType()); } - @ReactiveTransactional + @WithTransaction @GET @Path("model1") public Uni testModel1() { @@ -1545,7 +1436,7 @@ public Uni testModel1() { }); } - @ReactiveTransactional + @WithTransaction @GET @Path("model2") public Uni testModel2() { @@ -1562,7 +1453,7 @@ public Uni testModel2() { }); } - @ReactiveTransactional + @WithTransaction @GET @Path("projection1") public Uni testProjection() { @@ -1606,7 +1497,7 @@ public Uni testProjection() { }); } - @ReactiveTransactional + @WithTransaction @GET @Path("projection2") public Uni testProjection2() { @@ -1688,7 +1579,7 @@ public Uni testProjection2() { .replaceWith("OK"); } - @ReactiveTransactional + @WithTransaction @GET @Path("model3") public Uni testModel3() { @@ -1751,7 +1642,7 @@ public Uni testBug5885() { .map(v -> "OK"); } - @ReactiveTransactional + @WithTransaction @GET @Path("composite") public Uni testCompositeKey() { @@ -1813,7 +1704,7 @@ public Uni testBug7721() { .map(v -> "OK")); } - @ReactiveTransactional + @WithTransaction @GET @Path("8254") public Uni testBug8254() { @@ -1857,7 +1748,7 @@ public Uni testBug8254() { }); } - @ReactiveTransactional + @WithTransaction @GET @Path("9025") public Uni testBug9025() { @@ -1876,7 +1767,7 @@ public Uni testBug9025() { }); } - @ReactiveTransactional + @WithTransaction @GET @Path("9036") public Uni testBug9036() { @@ -1915,11 +1806,6 @@ public Uni testBug9036() { assertEquals(1, list.size()); assertEquals(livePerson, list.get(0)); - - return collect(query.stream()); - }).flatMap(list -> { - assertEquals(1, list.size()); - return query.firstResult(); }).flatMap(result -> { assertEquals(livePerson, result); @@ -1944,7 +1830,7 @@ public Uni testBug9036() { @GET @Path("testSortByNullPrecedence") - @ReactiveTransactional + @WithTransaction public Uni testSortByNullPrecedence() { return Person.deleteAll() .flatMap(v -> {