private ClassLoaderAccess getClassLoaderAccess() {
   if (classLoaderAccess == null) {
     MetadataBuildingOptions options = getMetadataBuildingOptions();
     ClassLoaderService classLoaderService =
         options.getServiceRegistry().getService(ClassLoaderService.class);
     classLoaderAccess =
         new ClassLoaderAccessImpl(options.getTempClassLoader(), classLoaderService);
   }
   return classLoaderAccess;
 }
  private static BasicTypeRegistry handleTypes(MetadataBuildingOptions options) {
    final ClassLoaderService classLoaderService =
        options.getServiceRegistry().getService(ClassLoaderService.class);

    // ultimately this needs to change a little bit to account for HHH-7792
    final BasicTypeRegistry basicTypeRegistry = new BasicTypeRegistry();

    final TypeContributions typeContributions =
        new TypeContributions() {
          public void contributeType(BasicType type) {
            basicTypeRegistry.register(type);
          }

          public void contributeType(BasicType type, String... keys) {
            basicTypeRegistry.register(type, keys);
          }

          public void contributeType(UserType type, String... keys) {
            basicTypeRegistry.register(type, keys);
          }

          public void contributeType(CompositeUserType type, String... keys) {
            basicTypeRegistry.register(type, keys);
          }
        };

    // add Dialect contributed types
    final Dialect dialect =
        options.getServiceRegistry().getService(JdbcServices.class).getDialect();
    dialect.contributeTypes(typeContributions, options.getServiceRegistry());

    // add TypeContributor contributed types.
    for (TypeContributor contributor : classLoaderService.loadJavaServices(TypeContributor.class)) {
      contributor.contribute(typeContributions, options.getServiceRegistry());
    }

    // add explicit application registered types
    for (BasicTypeRegistration basicTypeRegistration : options.getBasicTypeRegistrations()) {
      basicTypeRegistry.register(
          basicTypeRegistration.getBasicType(), basicTypeRegistration.getRegistrationKeys());
    }

    return basicTypeRegistry;
  }