org.hibernate.internal.ConnectionObserverStatsBridge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beangle-hibernate-core Show documentation
Show all versions of beangle-hibernate-core Show documentation
Hibernate Orm Core Shade,Support Scala Collection
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.internal;
import java.io.Serializable;
import java.sql.Connection;
import org.hibernate.engine.jdbc.spi.ConnectionObserver;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.stat.spi.StatisticsImplementor;
/**
* @author Steve Ebersole
*/
public class ConnectionObserverStatsBridge implements ConnectionObserver, Serializable {
private final SessionFactoryImplementor sessionFactory;
public ConnectionObserverStatsBridge(SessionFactoryImplementor sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
public void physicalConnectionObtained(Connection connection) {
final StatisticsImplementor statistics = sessionFactory.getStatistics();
if ( statistics.isStatisticsEnabled() ) {
statistics.connect();
}
}
@Override
public void physicalConnectionReleased() {
}
@Override
public void logicalConnectionClosed() {
}
@Override
public void statementPrepared() {
final StatisticsImplementor statistics = sessionFactory.getStatistics();
if ( statistics.isStatisticsEnabled() ) {
statistics.prepareStatement();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy