All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.engine.jdbc.connections.internal.ConnectionCreatorFactoryImpl Maven / Gradle / Ivy

There is a newer version: 5.6.15.Final
Show newest version
/*
 * 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.engine.jdbc.connections.internal;

import java.sql.Driver;
import java.util.Map;
import java.util.Properties;

import org.hibernate.service.spi.ServiceRegistryImplementor;

/**
 * The default factory for ConnectionCreator instances
 *
 * @author Christian Beikov
 */
public class ConnectionCreatorFactoryImpl implements ConnectionCreatorFactory {

	public static final ConnectionCreatorFactory INSTANCE = new ConnectionCreatorFactoryImpl();

	private ConnectionCreatorFactoryImpl() {
	}

	@Override
	public ConnectionCreator create(
			Driver driver,
			ServiceRegistryImplementor serviceRegistry,
			String url,
			Properties connectionProps,
			Boolean autoCommit,
			Integer isolation,
			String initSql,
			Map configurationValues) {
		if ( driver == null ) {
			return new DriverManagerConnectionCreator(
					serviceRegistry,
					url,
					connectionProps,
					autoCommit,
					isolation,
					initSql
			);
		}
		else {
			return new DriverConnectionCreator(
					driver,
					serviceRegistry,
					url,
					connectionProps,
					autoCommit,
					isolation,
					initSql
			);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy