@@ -0,0 +1,802 @@
+package no.kdrs.grouse;%0A%0Aimport org.hibernate.SessionFactory;%0Aimport org.hibernate.cfg.Configuration;%0A%0Apublic class HibernateUtil %7B%0A%0A%09private static final SessionFactory sessionFactory = buildSessionFactory();%0A%0A%09private static SessionFactory buildSessionFactory() %7B%0A%09%09try %7B%0A%09%09%09// Create the SessionFactory from hibernate.cfg.xml%0A%09%09%09return new Configuration().configure().buildSessionFactory();%0A%09%09%7D%0A%09%09catch (Throwable ex) %7B%0A%09%09%09// Make sure you log the exception, as it might be swallowed%0A%09%09%09System.err.println(%22Initial SessionFactory creation failed.%22 + ex);%0A%09%09%09throw new ExceptionInInitializerError(ex);%0A%09%09%7D%0A%09%7D%0A%0A%09public static SessionFactory getSessionFactory() %7B%0A%09%09return sessionFactory;%0A%09%7D%0A%0A%09public static void shutdown() %7B%0A%09%09// Close caches and connection pools%0A%09%09getSessionFactory().close();%0A%09%7D%0A%0A%7D%0A

Add Hibernate Utility class