{"record":{"id":"964adda00fcc2881","repo":"quarkusio/quarkus","slug":"no-entities-with-json-were-found","errorCode":null,"errorMessage":"No entities with json were found","messagePattern":"No entities with json were found","errorType":"http","errorClass":"AssertionError","httpStatus":500,"severity":"error","filePath":"integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java","lineNumber":147,"sourceCode":"        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)\n                    .getResultList();\n            if (entities.isEmpty()) {\n                throw new AssertionError(\"No entities with json were found\");\n            }\n        });\n\n        QuarkusTransaction.requiringNew().run(() -> {\n            em.createQuery(\"delete from EntityWithJson\").executeUpdate();\n        });\n\n        Exception exception = null;\n        try {\n            QuarkusTransaction.requiringNew().run(() -> {\n                EntityWithJsonOtherPU otherPU = new EntityWithJsonOtherPU(\n                        new EntityWithJsonOtherPU.ToBeSerializedWithDateTime(LocalDate.of(2023, 7, 28)));\n                otherEm.persist(otherPU);\n            });\n        } catch (Exception e) {\n            exception = e;\n        }\n","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java#L129-L165","documentation":"Assertion in the jpa-postgresql json endpoint. After storing EntityWithJson rows and querying 'select e from EntityWithJson e', the result list was empty, meaning the entities were never persisted (or the insert failed silently / hit a different table/schema).","triggerScenarios":"Persisting EntityWithJson in one transaction then querying all of them in a new transaction and getting an empty list — persist rolled back, JSON mapping failed before insert, or the query targets a different persistence unit/schema.","commonSituations":"Hibernate JSON mapping (hibernate-types / @JdbcTypeCode(SqlTypes.JSON)) misconfigured for the dialect, test schema not created, or transaction not committed before the read.","solutions":["Enable SQL logging to confirm the INSERT executed and committed","Verify the EntityWithJson mapping uses @JdbcTypeCode(SqlTypes.JSON) (Hibernate 6) for the json field","Ensure the persisting block runs in QuarkusTransaction.requiringNew() and completes without swallowing exceptions","Confirm the entity maps to the expected table in the current schema"],"exampleFix":"// before\n@Column(columnDefinition = \"json\")\nprivate String json;\n// after (Hibernate 6)\n@JdbcTypeCode(SqlTypes.JSON)\n@Column(columnDefinition = \"json\")\nprivate Map<String, Object> json;","handlingStrategy":"validation","validationCode":"long count = em.createQuery(\"select count(e) from EntityWithJson e\", Long.class).getSingleResult();\nif (count == 0) {\n    throw new IllegalStateException(\"No EntityWithJson rows persisted; check INSERT/commit\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    QuarkusTransaction.requiringNew().run(() -> em.persist(entity));\n} catch (RuntimeException e) {\n    throw new AssertionError(\"persisting EntityWithJson failed\", e);\n}","preventionTips":["Use @JdbcTypeCode(SqlTypes.JSON) for JSON fields in Hibernate 6","Enable SQL logging to confirm INSERT statements execute","Verify schema contains the json column before the test","Never swallow exceptions from the persisting transaction"],"tags":["jpa","postgresql","json","hibernate"],"backgroundTag":"jpa-entity-not-persisted","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"}