br.edu.ifrs.restinga.modulorh.dao.HibernateUtil.java Source code

Java tutorial

Introduction

Here is the source code for br.edu.ifrs.restinga.modulorh.dao.HibernateUtil.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.ifrs.restinga.modulorh.dao;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
    private static SessionFactory sessionfactory;

    public static SessionFactory getSessionFactory() {
        if (sessionfactory == null) {
            Configuration ac = new Configuration();
            ac.configure();
            sessionfactory = ac.buildSessionFactory();
        }
        return sessionfactory;
    }
}