String batchSize = config.getProperty("hibernate.jdbc.batch_size");
Integer batchSizeNumber = Integer.valueOf(batchSize);
this.setBatchSize(batchSizeNumber.intValue());
ServiceRegistry registry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
SessionFactory factory = config.buildSessionFactory(registry);
setSessionFactory(factory);
} catch (HibernateException exception) {
StringBuffer msg = new StringBuffer();
msg.append("Error when loading Hibernate configuration file. Message: '").append(exception.getMessage()).append("'.");
throw new SessionFactoryConfigurationException(msg.toString(), exception);