Environment.verifyProperties(properties);
ConfigurationHelper.resolvePlaceHolders(properties);
// build the serviceregistry
StandardServiceRegistryBuilder registry = new StandardServiceRegistryBuilder().applySettings(properties);
sessionFactory = configuration.buildSessionFactory( registry.build());
} catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}