Example usage for org.hibernate.context.internal ThreadLocalSessionContext unbind

List of usage examples for org.hibernate.context.internal ThreadLocalSessionContext unbind

Introduction

In this page you can find the example usage for org.hibernate.context.internal ThreadLocalSessionContext unbind.

Prototype

public static Session unbind(SessionFactory factory) 

Source Link

Document

Disassociates a previously bound session from the current thread of execution.

Usage

From source file:ar.com.pahema.hibernate.HibernateUtilWEB.java

public static void closeSessionAndUnbindFromThread() {
    Session session = ThreadLocalSessionContext.unbind(sessionFactory);
    if (session != null) {
        session.close();//  w ww.ja  v  a 2  s. com
    }
}

From source file:com.fpmislata.seguros.datos.hibernate.HibernateUtil.java

License:Apache License

public static void closeSessionAndDeattachFromThread() {
    Session session = ThreadLocalSessionContext.unbind(sessionFactory);
    if (session != null) {
        if (session.isOpen() == true) {
            session.close();//from   ww  w  .j a  v  a2 s  .c  o m
        }
    }
}