{"record":{"id":"e24eba949c5619c8","repo":"quarkusio/quarkus","slug":"incorrect-loaded-myuuidentity-myentity","errorCode":null,"errorMessage":"Incorrect loaded MyUUIDEntity \" + myEntity","messagePattern":"Incorrect loaded MyUUIDEntity \" \\+ myEntity","errorType":"http","errorClass":"RuntimeException","httpStatus":500,"severity":"error","filePath":"integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java","lineNumber":126,"sourceCode":"\n    private static String randomName() {\n        return UUID.randomUUID().toString();\n    }\n\n    @GET\n    @Path(\"uuid\")\n    public String uuid() {\n        var id = QuarkusTransaction.requiringNew().call(() -> {\n            MyUUIDEntity myEntity = new MyUUIDEntity();\n            myEntity.setName(\"George\");\n            em.persist(myEntity);\n            return myEntity.getId();\n        });\n\n        QuarkusTransaction.requiringNew().run(() -> {\n            var myEntity = em.find(MyUUIDEntity.class, id);\n            if (myEntity == null || !\"George\".equals(myEntity.getName())) {\n                throw new RuntimeException(\"Incorrect loaded MyUUIDEntity \" + myEntity);\n            }\n        });\n        return \"OK\";\n    }\n\n    @GET\n    @Path(\"json\")\n    public String json() {\n        QuarkusTransaction.requiringNew().run(() -> {\n            EntityWithJson entity = new EntityWithJson(\n                    new EntityWithJson.ToBeSerializedWithDateTime(LocalDate.of(2023, 7, 28)),\n                    new SomeEmbeddable(100, LocalDate.of(2023, 7, 29)));\n            em.persist(entity);\n        });\n\n        QuarkusTransaction.requiringNew().run(() -> {\n            List<EntityWithJson> entities = em\n                    .createQuery(\"select e from EntityWithJson e\", EntityWithJson.class)","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java#L108-L144","documentation":"Assertion in the jpa-postgresql uuid endpoint. After persisting a MyUUIDEntity (ID generated as UUID) in one transaction and re-loading it with em.find in a new transaction, the entity was either null or its name was not 'George', meaning UUID-id persistence/lookup round-trip failed.","triggerScenarios":"em.find(MyUUIDEntity.class, id) in a fresh transaction returning null (row not committed, wrong UUID generation strategy) or a row whose name column wasn't persisted correctly.","commonSituations":"UUID generator misconfiguration (@UuidGenerator vs @GeneratedValue mismatch), transaction isolation/commit issues, or dialect problems with uuid column types in PostgreSQL.","solutions":["Check MyUUIDEntity is annotated with @UuidGenerator (or equivalent) on the id and the column type is uuid","Confirm the persisting transaction committed before the find (QuarkusTransaction.requiringNew)","Enable SQL logging to see the INSERT and SELECT statements","Verify the name field is not marked transient/ignorable"],"exampleFix":"// before\n@Entity\npublic class MyUUIDEntity {\n    @Id @GeneratedValue\n    private UUID id;\n}\n// after\n@Entity\npublic class MyUUIDEntity {\n    @Id @UuidGenerator\n    private UUID id;\n}","handlingStrategy":"validation","validationCode":"// before relying on UUID round-trip, verify the row exists\nLong exists = (Long) em.createQuery(\"select count(e) from MyUUIDEntity e where e.id = :id\")\n        .setParameter(\"id\", id).getSingleResult();\nif (exists != 1) {\n    throw new IllegalStateException(\"MyUUIDEntity \" + id + \" was not persisted\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    MyUUIDEntity e = em.find(MyUUIDEntity.class, id);\n    if (e == null) throw new AssertionError(\"Entity not found: \" + id);\n} catch (RuntimeException ex) {\n    throw new AssertionError(\"UUID entity lookup failed\", ex);\n}","preventionTips":["Use @UuidGenerator for UUID ids in Hibernate 6+","Persist and load in separate committed transactions to catch commit issues","Enable SQL logging to inspect INSERT/SELECT for UUID columns","Ensure the id column maps to PostgreSQL native uuid type"],"tags":["jpa","postgresql","uuid","entity-mapping"],"backgroundTag":"jpa-uuid-entity-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}