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

org.hibernate.testing.cleaner.DatabaseCleaner Maven / Gradle / Ivy

There is a newer version: 7.0.0.Beta2
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.testing.cleaner;

import java.sql.Connection;

/**
 * @author Christian Beikov
 */
public interface DatabaseCleaner {

	static void clearSchemas() {
		final DatabaseCleaner cleaner = DatabaseCleanerContext.CLEANER;
		if ( cleaner != null ) {
			JdbcConnectionContext.work( cleaner::clearAllSchemas );
		}
	}

	static void clearData() {
		final DatabaseCleaner cleaner = DatabaseCleanerContext.CLEANER;
		if ( cleaner != null ) {
			JdbcConnectionContext.work( cleaner::clearAllData );
		}
	}

	void addIgnoredTable(String tableName);

	boolean isApplicable(Connection connection);

	void clearAllSchemas(Connection connection);

	void clearSchema(Connection connection, String schemaName);

	void clearAllData(Connection connection);

	void clearData(Connection connection, String schemaName);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy