diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index 0eae9885dffd..d3ff949a5ef8 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -226,6 +226,14 @@ public SessionFactoryImpl(final MetadataImplementor metadata, SessionFactoryOpti this.properties = new HashMap<>(); this.properties.putAll( serviceRegistry.getService( ConfigurationService.class ).getSettings() ); + if ( !properties.containsKey( AvailableSettings.JPA_VALIDATION_FACTORY ) ) { + if ( getSessionFactoryOptions().getValidatorFactoryReference() != null ) { + properties.put( + AvailableSettings.JPA_VALIDATION_FACTORY, + getSessionFactoryOptions().getValidatorFactoryReference() + ); + } + } maskOutSensitiveInformation(this.properties); this.sqlFunctionRegistry = new SQLFunctionRegistry( jdbcServices.getJdbcEnvironment().getDialect(), options.getCustomSqlFunctionMap() ); this.cacheAccess = this.serviceRegistry.getService( CacheImplementor.class );