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

org.hibernate.boot.model.relational.AuxiliaryDatabaseObject Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha1
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.boot.model.relational;

import java.io.Serializable;

import org.hibernate.dialect.Dialect;

/**
 * Auxiliary database objects (i.e., triggers, stored procedures, etc) defined
 * in the mappings.  Allows Hibernate to manage their lifecycle as part of
 * creating/dropping the schema.
 *
 * @author Steve Ebersole
 */
public interface AuxiliaryDatabaseObject extends Exportable, Serializable {
	/**
	 * Does this database object apply to the given dialect?
	 *
	 * @param dialect The dialect to check against.
	 * @return True if this database object does apply to the given dialect.
	 */
	public boolean appliesToDialect(Dialect dialect);

	/**
	 * Defines a simple precedence.  Should creation of this auxiliary object happen beforeQuery creation of
	 * tables?  If {@code true}, the auxiliary object creation will happen afterQuery any explicit schema creations
	 * but beforeQuery table/sequence creations; if {@code false}, the auxiliary object creation will happen afterQuery
	 * explicit schema creations and afterQuery table/sequence creations.
	 *
	 * This precedence is automatically inverted for dropping.
	 *
	 * @return {@code true} indicates this object should be created beforeQuery tables; {@code false} indicates
	 * it should be created afterQuery.
	 */
	public boolean beforeTablesOnCreation();

	/**
	 * Gets the SQL strings for creating the database object.
	 *
	 * @param dialect The dialect for which to generate the SQL creation strings
	 *
	 * @return the SQL strings for creating the database object.
	 */
	public String[] sqlCreateStrings(Dialect dialect);

	/**
	 * Gets the SQL strings for dropping the database object.
	 *
	 * @param dialect The dialect for which to generate the SQL drop strings
	 *
	 * @return the SQL strings for dropping the database object.
	 */
	public String[] sqlDropStrings(Dialect dialect);

	/**
	 * Additional, optional interface for AuxiliaryDatabaseObject that want to allow
	 * expansion of allowable dialects via mapping.
	 */
	public static interface Expandable {
		public void addDialectScope(String dialectName);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy