diff --git a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/defaultpu/TestEndpoint.java b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/defaultpu/TestEndpoint.java index 07b56adcd78985..624d86daa926e5 100644 --- a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/defaultpu/TestEndpoint.java +++ b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/defaultpu/TestEndpoint.java @@ -1860,4 +1860,27 @@ public String testBug31117() { Assertions.assertEquals(1, Person.delete("\r\n \n\ndelete\nfrom\n Person2\nwhere\nname = ?1", "foo")); return "OK"; } + + @GET + @Path("42416") + @Transactional + public String testBug42416() { + Person.deleteAll(); + Person p = new Person(); + p.name = "stef"; + p.persist(); + + Person p2 = new Person(); + p2.name = "stef"; + p2.persist(); + + try { + Person found = Person.find("where name = ?1", "stef").singleResult(); + } catch (jakarta.persistence.NonUniqueResultException e) { + return "OK"; + } catch (org.hibernate.NonUniqueResultException e) { + e.printStackTrace(); + return "KO"; + } + } }