HHH-12948 Allow using a custom SessionFactoryOptionsBuilder to create a SessionFactoryBuilderImpl

This commit is contained in:
Sanne Grinovero 2018-09-04 16:09:35 +01:00
parent 8cf00ad3fd
commit 935601e29d
1 changed files with 6 additions and 3 deletions

View File

@ -45,12 +45,15 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
private final SessionFactoryOptionsBuilder optionsBuilder; private final SessionFactoryOptionsBuilder optionsBuilder;
public SessionFactoryBuilderImpl(MetadataImplementor metadata, BootstrapContext bootstrapContext) { public SessionFactoryBuilderImpl(MetadataImplementor metadata, BootstrapContext bootstrapContext) {
this.metadata = metadata; this( metadata, new SessionFactoryOptionsBuilder(
this.optionsBuilder = new SessionFactoryOptionsBuilder(
metadata.getMetadataBuildingOptions().getServiceRegistry(), metadata.getMetadataBuildingOptions().getServiceRegistry(),
bootstrapContext bootstrapContext
); ) );
}
public SessionFactoryBuilderImpl(MetadataImplementor metadata, SessionFactoryOptionsBuilder optionsBuilder) {
this.metadata = metadata;
this.optionsBuilder = optionsBuilder;
if ( metadata.getSqlFunctionMap() != null ) { if ( metadata.getSqlFunctionMap() != null ) {
for ( Map.Entry<String, SQLFunction> sqlFunctionEntry : metadata.getSqlFunctionMap().entrySet() ) { for ( Map.Entry<String, SQLFunction> sqlFunctionEntry : metadata.getSqlFunctionMap().entrySet() ) {
applySqlFunction( sqlFunctionEntry.getKey(), sqlFunctionEntry.getValue() ); applySqlFunction( sqlFunctionEntry.getKey(), sqlFunctionEntry.getValue() );