hibernate/hibernate-orm · error · MappingException
Temporal precision (TemporalType) mismatch; requested precis
Error message
Temporal precision (TemporalType) mismatch; requested precision = %s; explicit JavaType (%s) precision = %s
What it means
Error "Temporal precision (TemporalType) mismatch; requested precision = %s; explicit JavaType (%s) precision = %s" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/InferredBasicValueResolver.java:628
private static <T> @Nonnull InferredBasicValueResolution<T, T> fromTemporalExplicitJavaType(
BasicJavaType<?> explicitJavaType,
JdbcType explicitJdbcType,
Function<TypeConfiguration, MutabilityPlan<?>> explicitMutabilityPlanAccess,
JdbcTypeIndicators stdIndicators) {
final var typeConfiguration = stdIndicators.getTypeConfiguration();
final var basicTypeRegistry = typeConfiguration.getBasicTypeRegistry();
final var requestedTemporalPrecision = stdIndicators.getTemporalPrecision();
if ( !isTemporal( explicitJavaType ) ) {
throw new MappingException( "Explicit JavaType [" + explicitJavaType +
"] defined for temporal value must implement TemporalJavaType" );
}
@SuppressWarnings("unchecked")
final var explicitTemporalJtd = (TemporalJavaType<T>) explicitJavaType;
if ( requestedTemporalPrecision != null
&& explicitTemporalJtd.getPrecision() != requestedTemporalPrecision ) {
throw new MappingException(
"Temporal precision (TemporalType) mismatch; requested precision = %s; explicit JavaType (%s) precision = %s"
.formatted( requestedTemporalPrecision, explicitTemporalJtd, explicitTemporalJtd.getPrecision() )
);
}
final var jdbcType =
explicitJdbcType != null
? explicitJdbcType
: explicitTemporalJtd.getRecommendedJdbcType( stdIndicators );
final var jdbcMapping = basicTypeRegistry.resolve( explicitTemporalJtd, jdbcType );
return new InferredBasicValueResolution<>(
jdbcMapping,
explicitTemporalJtd,
explicitTemporalJtd,
jdbcType,
jdbcMapping,
determineMutabilityPlan( explicitMutabilityPlanAccess, explicitTemporalJtd, typeConfiguration )View on GitHub (pinned to fad1729dce)
Solutions
- Align @Temporal(TemporalType...) with the precision of the explicitly configured JavaType, or remove one of the two specifications.
Example fix
Align @Temporal(TemporalType...) with the precision of the explicitly configured JavaType, or remove one of the two specifications.
When it happens
Trigger: An entity mapping annotation or bootstrap configuration violates a Hibernate mapping rule.
Common situations: Annotation mapping mistakes: inverse-side @Id associations, @Column on @OneToOne, unmapped association targets, mismatched @EnumeratedValue/@Temporal usage, duplicate sequence generators.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/828afc6b190adda2.
Report an issue: GitHub.