org.hibernate.testing.cleaner.DatabaseCleaner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-testing-jakarta Show documentation
Show all versions of hibernate-testing-jakarta Show documentation
Support for testing Hibernate ORM Jakarta functionality
/*
* 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);
}