@BeforeClassOnce
 @SuppressWarnings({"UnusedDeclaration"})
 protected void buildSessionFactory() {
   // for now, build the configuration to get all the property settings
   configuration = constructAndConfigureConfiguration();
   BootstrapServiceRegistry bootRegistry = buildBootstrapServiceRegistry();
   serviceRegistry = buildServiceRegistry(bootRegistry, configuration);
   isMetadataUsed =
       serviceRegistry
           .getService(ConfigurationService.class)
           .getSetting(
               USE_NEW_METADATA_MAPPINGS,
               new ConfigurationService.Converter<Boolean>() {
                 @Override
                 public Boolean convert(Object value) {
                   return Boolean.parseBoolean((String) value);
                 }
               },
               false);
   if (isMetadataUsed) {
     MetadataImplementor metadataImplementor = buildMetadata(bootRegistry, serviceRegistry);
     afterConstructAndConfigureMetadata(metadataImplementor);
     sessionFactory = (SessionFactoryImplementor) metadataImplementor.buildSessionFactory();
   } else {
     // this is done here because Configuration does not currently support 4.0 xsd
     afterConstructAndConfigureConfiguration(configuration);
     sessionFactory =
         (SessionFactoryImplementor) configuration.buildSessionFactory(serviceRegistry);
   }
   afterSessionFactoryBuilt();
 }