Create sessionFactory in Hibernate 4.3

private static SessionFactory buildSessionFactory() { try{ Configuration configuration = new Configuration(); configuration.configure(); StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder(); builder.applySettings(configuration.getProperties()); StandardServiceRegistry serviceRegistry = builder.build(); return configuration.buildSessionFactory(serviceRegistry); }catch(Throwable ex){ System.err.println("Fallo al crear la session Factory inicial"); throw new ExceptionInInitializerError(ex); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.