Example usage for org.hibernate StatelessSession connection

List of usage examples for org.hibernate StatelessSession connection

Introduction

In this page you can find the example usage for org.hibernate StatelessSession connection.

Prototype

@Deprecated
Connection connection();

Source Link

Document

Returns the current JDBC connection associated with this instance.

If the session is using aggressive connection release (as in a CMT environment), it is the application's responsibility to close the connection returned by this call.

Usage

From source file:org.openbravo.service.db.DalConnectionProvider.java

License:Open Source License

public Connection getTransactionConnection() throws NoConnectionAvailableException, SQLException {
    final StatelessSession session = SessionFactoryController.getInstance().getSessionFactory()
            .openStatelessSession();//from   ww w  .  j a  va  2s.com
    Connection conn = session.connection();

    if (conn == null) {
        throw new NoConnectionAvailableException("Couldnt get an available connection");
    }
    conn.setAutoCommit(false);
    return conn;
}