Skip to content

Instantly share code, notes, and snippets.

@rvazquezglez
Created December 1, 2012 11:29
Show Gist options
  • Save rvazquezglez/4181612 to your computer and use it in GitHub Desktop.
Save rvazquezglez/4181612 to your computer and use it in GitHub Desktop.
Clase de utilería para mantener una sola fábrica de sesión.
public class HibernateUtil {
private static final SessionFactory sessionFactory;
/**
* Inicializa la fabrica de sesiones de hibernate
*/
static {
sessionFactory = new Configuration().
configure().
buildSessionFactory();
}
/**
* Regresa la fabrica de sesiones.
* @return Fabrica de sesiones.
*/
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment