diff --git a/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointFetchLazy.java b/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointFetchLazy.java index ff1b103592e0a..c0dcda200b2f5 100644 --- a/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointFetchLazy.java +++ b/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointFetchLazy.java @@ -34,6 +34,14 @@ public Uni> findBooksWithMutiny(@PathParam("authorId") Integer .chain(author -> Mutiny.fetch(author.getBooks())); } + @GET + @Path("/getReferenceBooksWithMutiny/{authorId}") + public Uni> getReferenceBooksWithMutiny(@PathParam("authorId") Integer authorId) { + return mutinySession + .fetch(mutinySession.getReference(Author.class, authorId)) + .chain(author -> Mutiny.fetch(author.getBooks())); + } + @POST @Path("/prepareDb") public Uni prepareDb() { diff --git a/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveFetchLazyTest.java b/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveFetchLazyTest.java index 1cb288ff8602f..f2ee76ed68657 100644 --- a/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveFetchLazyTest.java +++ b/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveFetchLazyTest.java @@ -18,6 +18,20 @@ @TestHTTPEndpoint(HibernateReactiveTestEndpointFetchLazy.class) public class HibernateReactiveFetchLazyTest { + @Test + public void fetchAfterGetReferenceWithMutiny() { + RestAssured.when() + .post("/prepareDb") + .then() + .body(is("Neal Stephenson")); + + Response response = RestAssured.when() + .get("/getReferenceBooksWithMutiny/567") + .then() + .extract().response(); + assertTitles(response, "Cryptonomicon", "Snow Crash"); + } + @Test public void fetchAfterFindWithMutiny() { RestAssured.when()