This commit is contained in:
RafayAhmad7548 2024-09-09 16:59:28 +05:00
parent 2992f4f408
commit 4f46de8d00
3330 changed files with 394553 additions and 76939 deletions

View file

@ -0,0 +1 @@
{"version":1,"resource":"file:///home/rafayahmad/Stuff/Coding/Java/HCloud/hcloudserver/src/main/java/com/rutils/HibernateUtil.java","entries":[{"id":"g1v0.java","timestamp":1720764260936}]}

View file

@ -0,0 +1,27 @@
package com.rutils;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil{
private static final SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory(){
try{
return new Configuration().configure().buildSessionFactory();
}
catch(Throwable e){
System.err.println("Session Factory creation failed" + e);
throw new ExceptionInInitializerError(e);
}
}
public static SessionFactory getSessionfactory(){
return sessionFactory;
}
public static void shutdown(){
getSessionfactory().close();
}
}