{"record":{"id":"3bc22b3a62671931","repo":"hibernate/hibernate-orm","slug":"settings-hibernate-temporal-use-server-transactio","errorCode":null,"errorMessage":"Settings 'hibernate.temporal.use_server_transaction_timestamps' and 'hibernate.temporal.changeset_id_supplier' are mutually exclusive","messagePattern":"Settings 'hibernate\\.temporal\\.use_server_transaction_timestamps' and 'hibernate\\.temporal\\.changeset_id_supplier' are mutually exclusive","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/temporal/internal/ChangesetCoordinatorImpl.java","lineNumber":55,"sourceCode":" *\n * @since 7.4\n */\npublic class ChangesetCoordinatorImpl\n\t\timplements ChangesetCoordinator, ChangesetIdentifierSupplier<Instant> {\n\n\tprivate Class<?> identifierValueType;\n\tprivate ChangesetIdentifierSupplier<?> identifierSupplier;\n\tprivate final boolean useServerTransactionTimestamps;\n\n\tpublic ChangesetCoordinatorImpl(ServiceRegistry serviceRegistry) {\n\t\tfinal var settings =\n\t\t\t\tserviceRegistry.requireService( ConfigurationService.class )\n\t\t\t\t\t\t.getSettings();\n\t\tuseServerTransactionTimestamps =\n\t\t\t\tgetBoolean( USE_SERVER_TRANSACTION_TIMESTAMPS, settings );\n\t\tif ( useServerTransactionTimestamps ) {\n\t\t\tif ( settings.containsKey( CHANGESET_ID_SUPPLIER ) ) {\n\t\t\t\tthrow new MappingException( \"Settings '\"\n\t\t\t\t\t\t\t\t\t\t\t+ USE_SERVER_TRANSACTION_TIMESTAMPS + \"' and '\"\n\t\t\t\t\t\t\t\t\t\t\t+ CHANGESET_ID_SUPPLIER + \"' are mutually exclusive\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tfinal var dialect = serviceRegistry.requireService( JdbcServices.class ).getDialect();\n\t\t\tidentifierSupplier = dialect.isCurrentTimestampStable()\n\t\t\t\t\t? null\n\t\t\t\t\t: new CurrentTimestampChangesetIdentifierSupplier();\n\t\t\tidentifierValueType = Instant.class;\n\t\t}\n\t\telse {\n\t\t\tidentifierSupplier =\n\t\t\t\t\tresolveSupplier( settings,\n\t\t\t\t\t\t\tserviceRegistry.requireService( StrategySelector.class ) );\n\t\t\tidentifierValueType = resolveSuppliedType( supplierClass( identifierSupplier ) );\n\t\t}\n\t}\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/temporal/internal/ChangesetCoordinatorImpl.java#L37-L73","documentation":"The temporal (versioned-data) coordinator decides at bootstrap how changeset identifiers are produced. hibernate.temporal.use_server_transaction_timestamps=true derives ids from the database's current timestamp; hibernate.temporal.changeset_id_supplier delegates generation to a custom supplier. Both present is contradictory — two competing id sources — so ChangesetCoordinatorImpl throws a MappingException during SessionFactory construction.","triggerScenarios":"A settings map, persistence.xml, or properties file containing both hibernate.temporal.use_server_transaction_timestamps=true and any value (instance, Class, or class name) under hibernate.temporal.changeset_id_supplier; the constructor's containsKey check fires immediately.","commonSituations":"Copy-pasting properties from two different temporal-versioning examples; enabling a preset bundle of temporal settings without pruning; config templates where the supplier was the old approach and server timestamps the newer one.","solutions":["If you want server transaction timestamps, remove the hibernate.temporal.changeset_id_supplier entry entirely.","If you want the custom supplier, remove hibernate.temporal.use_server_transaction_timestamps (or leave it unset/false)."],"exampleFix":"# before\nhibernate.temporal.use_server_transaction_timestamps=true\nhibernate.temporal.changeset_id_supplier=org.acme.UuidSupplier\n\n# after\nhibernate.temporal.changeset_id_supplier=org.acme.UuidSupplier","handlingStrategy":"validation","validationCode":"boolean useServerTs = Boolean.parseBoolean(\n        String.valueOf(settings.getOrDefault(\"hibernate.temporal.use_server_transaction_timestamps\", \"false\")));\nif (useServerTs && settings.containsKey(\"hibernate.temporal.changeset_id_supplier\")) {\n    throw new IllegalStateException(\n        \"Pick one: server transaction timestamps OR a changeset id supplier, not both\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep temporal-versioning properties in one reviewed block of config, not scattered copies.","Validate the settings map for known exclusive pairs before buildSessionFactory().","Document which id-generation mode each environment uses."],"tags":["hibernate","temporal-versioning","configuration","mutually-exclusive-settings","mappingexception"],"backgroundTag":"mutually-exclusive-config-settings","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}