hibernate/hibernate-orm · error · IllegalStateException

Temporal starting and ending columns must use the same JDBC…

Error message

Temporal starting and ending columns must use the same JDBC mapping

What it means

Temporal-mapping validation during metamodel building: the ROW_START and ROW_END auxiliary columns of a temporal mapping resolved to different JDBC mappings, but the versioning arithmetic requires them to match.

Solutions

  1. Use the same @JdbcTypeCode/type mapping for both the start and end temporal columns of the range mapping.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown when the starting and ending columns of a temporal (validity) mapping use different JDBC type mappings.

Common situations: See trigger scenarios.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/1545e27bf433e085. Report an issue: GitHub.

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/TemporalMappingImpl.java:91

			MappingModelCreationProcess creationProcess) {
		this.tableName = tableName;

		final var creationContext = creationProcess.getCreationContext();
		temporalTableStrategy =
				creationContext.getSessionFactoryOptions()
						.getTemporalTableStrategy();

		final var startingColumn = bootMapping.getAuxiliaryColumn( ROW_START );
		final var endingColumn = bootMapping.getAuxiliaryColumn( ROW_END );
		final var startingValue = (BasicValue) startingColumn.getValue();
		final var endingValue = (BasicValue) endingColumn.getValue();

		final var startingResolution = startingValue.resolve();
		final var endingResolution = endingValue.resolve();

		jdbcMapping = startingResolution.getJdbcMapping();
		if ( jdbcMapping != endingResolution.getJdbcMapping() ) {
			throw new IllegalStateException( "Temporal starting and ending columns must use the same JDBC mapping" );
		}

		startingColumnMapping = startingColumnMapping( tableName, startingColumn, creationContext );
		endingColumnMapping = endingColumnMapping( tableName, endingColumn, creationContext );

		final var dialect = creationContext.getDialect();
		if ( creationContext.getSessionFactory()
				.getChangesetCoordinator()
				.useServerTimestamp( dialect ) ) {
			currentTimestampFunctionName = dialect.currentTimestamp();
			currentTimestampExpression =
					new SelfRenderingSqlFragmentExpression( currentTimestampFunctionName, jdbcMapping );
		}
		else {
			currentTimestampFunctionName = null;
			currentTimestampExpression = null;
		}
	}

View on GitHub (pinned to fad1729dce)