throws HibernateException {
Configuration configuration = new Configuration();
configuration.configure("hibernate_sp.cfg.xml");
ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder()
.applySettings(configuration.getProperties());
sessionFactory = configuration
.buildSessionFactory(serviceRegistryBuilder
.buildServiceRegistry());
return sessionFactory;
}