Hibernate_.Util.java
package com.jtc.p1;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class Hibernate_Util {
static SessionFactory factory;
static {
try {
Configuration cfg=new Configuration().configure("hibernate.cfg.xml");
factory=cfg.buildSessionFactory();
}catch(Exception e) {
e.printStackTrace();
}
}
public static SessionFactory getSessionFatory() {
return factory;
}
}
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class Hibernate_Util {
static SessionFactory factory;
static {
try {
Configuration cfg=new Configuration().configure("hibernate.cfg.xml");
factory=cfg.buildSessionFactory();
}catch(Exception e) {
e.printStackTrace();
}
}
public static SessionFactory getSessionFatory() {
return factory;
}
}
Comments
Post a Comment