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

Error "Temporal starting and ending columns must use the same JDBC mapping" thrown in hibernate/hibernate-orm.

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)

Solutions

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

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.