hibernate/hibernate-orm · error · IllegalStateException

'@TimeZoneColumn' can not be used in conjunction with '@Time

Error message

'@TimeZoneColumn' can not be used in conjunction with '@TimeZoneStorage( {} )' for attribute '{}.{}'

What it means

Error "'@TimeZoneColumn' can not be used in conjunction with '@TimeZoneStorage( {} )' for attribute '{}.{}'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/BasicValueBinder.java:1075

		final var enumerated = attribute.getDirectAnnotationUsage( Enumerated.class );
		if ( enumerated != null ) {
			enumType = enumerated.value();
		}

		//noinspection deprecation
		final var temporal = attribute.getDirectAnnotationUsage( Temporal.class );
		if ( temporal != null ) {
			temporalPrecision = temporal.value();
		}

		final var timeZoneStorage = attribute.getDirectAnnotationUsage( TimeZoneStorage.class );
		if ( timeZoneStorage != null ) {
			timeZoneStorageType = timeZoneStorage.value();
			final var timeZoneColumnAnn = attribute.getDirectAnnotationUsage( TimeZoneColumn.class );
			if ( timeZoneColumnAnn != null ) {
				if ( timeZoneStorageType != TimeZoneStorageType.AUTO
						&& timeZoneStorageType != TimeZoneStorageType.COLUMN ) {
					throw new IllegalStateException(
							"'@TimeZoneColumn' can not be used in conjunction with '@TimeZoneStorage( "
							+ timeZoneStorageType + " )' for attribute '"
							+ attribute.getDeclaringType().getName() + '.' + attribute.getName() + "'"
					);
				}
			}
		}

		partitionKey = attribute.hasDirectAnnotationUsage( PartitionKey.class );
	}

	@Override
	public Dialect getDialect() {
		return getMetadataCollector().getDatabase().getDialect();
	}

	private void applyJpaConverter(MemberDetails attribute, ConverterDescriptor<?,?> attributeConverterDescriptor) {
		final boolean autoApply = attributeConverterDescriptor.getAutoApplyDescriptor().isAutoApplicable();

View on GitHub (pinned to fad1729dce)

Solutions

  1. Remove either @TimeZoneColumn or @TimeZoneStorage from the attribute; they cannot be combined.
  2. Keep @TimeZoneStorage and configure the storage strategy there if both behaviors were intended.

When it happens

Trigger: Two mutually exclusive annotations are placed on the same property or class.

Common situations: Combining annotations Hibernate treats as alternatives (e.g. @DynamicInsert with @SQLInsert, @MapKey with @MapKeyColumn), often after copy-pasting mappings or upgrading versions.


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