{"record":{"id":"3067f26bb0c25a29","repo":"quarkusio/quarkus","slug":"default-mapper-cannot-process-date-time-properties","errorCode":null,"errorMessage":"Default mapper cannot process date/time properties. So we were expecting transaction to fail, but it did not!","messagePattern":"Default mapper cannot process date/time properties\\. So we were expecting transaction to fail, but it did not!","errorType":"http","errorClass":"AssertionError","httpStatus":500,"severity":"warning","filePath":"integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java","lineNumber":167,"sourceCode":"        });\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\n        if (exception == null) {\n            throw new AssertionError(\n                    \"Default mapper cannot process date/time properties. So we were expecting transaction to fail, but it did not!\");\n        }\n        if (!(exception instanceof UnsupportedOperationException)\n                || !exception.getMessage().contains(\"I cannot convert anything to JSON\")) {\n            throw new AssertionError(\"flush failed for a different reason than expected.\", exception);\n        }\n\n        return \"OK\";\n    }\n\n}\n","sourceCodeStart":149,"sourceCodeEnd":179,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java#L149-L179","documentation":"This endpoint intentionally stores an entity whose JSON mapper cannot handle date/time properties; the test expects flush() to fail with UnsupportedOperationException ('I cannot convert anything to JSON'). If no exception was thrown, the guard the test relies on is missing and it throws this AssertionError.","triggerScenarios":"Persisting an EntityWithJson containing LocalDate/LocalDateTime with the default (non-date-aware) JSON mapper, then flushing, and the operation unexpectedly succeeds — mapper configuration changed or dates were silently serialized.","commonSituations":"Upgrading Hibernate Reactive/hibernate-types so date/time JSON support changed, swapping the default ObjectMapper for one that serializes dates, or dialect changes making the column a plain varchar.","solutions":["Verify the default JSON mapper in use is the one that rejects date/time types (throws 'I cannot convert anything to JSON')","Check dependency versions (hibernate-reactive / hypersistence-utils) for changed JSON mapper behavior","Confirm the json column actually goes through the JSON mapper (right @JdbcTypeCode/dialect) rather than being stored as text","Update the test expectation if the library now legitimately supports date/time serialization"],"exampleFix":"// before\nif (exception == null) {\n    throw new AssertionError(\"expecting transaction to fail, but it did not!\");\n}\n// after (diagnose what actually happened)\nif (exception == null) {\n    throw new AssertionError(\"expecting transaction to fail, but it did not! Mapper=\" + mapper.getClass());\n}","handlingStrategy":"try-catch","validationCode":"// confirm mapper behavior before relying on it\ntry {\n    mapper.toJson(Map.of(\"d\", LocalDate.now()));\n    throw new IllegalStateException(\"Mapper unexpectedly supports dates; test premise invalid\");\n} catch (UnsupportedOperationException expected) { /* good */ }","typeGuard":null,"tryCatchPattern":"try {\n    QuarkusTransaction.requiringNew().run(() -> { em.persist(e); em.flush(); });\n} catch (UnsupportedOperationException uoe) {\n    // expected when default mapper meets date/time properties\n}","preventionTips":["Pin hibernate-reactive/hypersistence-utils versions in tests","Document expected mapper limitations next to the test","Check library release notes for JSON date/time support changes","Assert the exact exception type and message"],"tags":["jpa","postgresql","json","date-time","test-assertion"],"backgroundTag":"json-serialization-unsupported-type","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"}