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

org.hibernate.tool.api.reveng.RevengDialect Maven / Gradle / Ivy

There is a newer version: 7.0.0.Beta1
Show newest version
package org.hibernate.tool.api.reveng;

import java.util.Iterator;
import java.util.Map;

import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;

/**
 * Interface for fetching metadata from databases.
 * The dialect is configured with a ConnectionProvider but is not
 * required to actually use any connections.
 * 
 * The metadata methods all returns Iterator and allows for more efficient and partial reads
 * for those databases that has "flakey" JDBC metadata implementions. 
 *  
 * @author Max Rydahl Andersen
 *
 */
public interface RevengDialect {

	/**
	 * Configure the metadatadialect. 
	 * @param connectionProvider a {@link ConnectionProvider} 
	 */
	public void configure(ConnectionProvider connectionProvider);
	
	/** 
	 * Return iterator over the tables that mathces catalog, schema and table
	 * 
	 * @param catalog name or null
	 * @param schema name or null
	 * @param table name or null 
	 * @return iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "TABLE_TYPE" keys. 
	 */
	Iterator> getTables(String catalog, String schema, String table);

	/**
	 * Close the iterator.
	 * @param iterator an iterator returned from one of methods on this dialect
	 */
	void close(Iterator iterator);

	/** 
	 * Return iterator over the indexes that mathces catalog, schema and table
	 * 
	 * @param catalog name or null
	 * @param schema name or null
	 * @param table name or null 
	 * @return iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "INDEX_NAME", "COLUMN_NAME", "NON_UNIQUE", "TYPE" keys. 
	 */
	Iterator> getIndexInfo(String catalog, String schema, String table);

	/**
	 * Return iterator over the columns that mathces catalog, schema and table
	 * 
	 * @param catalog name or null
	 * @param schema name or null
	 * @param table name or null
	 * @param column name or null
	 * @return iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "DATA_TYPE", "TYPE_NAME", "COLUMN_NAME", "NULLABLE", "COLUMN_SIZE", "DECIMAL_DIGITS"
	 */
	Iterator> getColumns(String catalog, String schema, String table, String column);

	/**
	 * Return iterator over the columns that mathces catalog, schema and table
	 * 
	 * @param catalog name or null
	 * @param schema name or null
	 * @param table name or null
	 * @return iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "COLUMN_NAME", "KEY_SEQ", "PK_NAME",
	 */
	Iterator> getPrimaryKeys(String catalog, String schema, String name);


	/**
	 * Return iterator over the exported foreign keys that mathces catalog, schema and table
	 * 
	 * @param catalog name or null
	 * @param schema name or null
	 * @param table name or null
	 * @return iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "FKTABLE_CAT", "FKTABLE_SCHEM", "FKTABLE_NAME", "FK_NAME", "KEY_SEQ"
	 */
	Iterator> getExportedKeys(String catalog, String schema, String table);

	/**
	 * Does this name need quoting
	 * 
	 * @param name
	 * @return
	 */
	boolean needQuote(String name);
	
	/**
	 * Close any resources this dialect might have used.
	 */
	void close();

	/**
	 * Use database (possible native) metadata to suggest identifier strategy. 
	 * 
	 * @param catalog
	 * @param schema
	 * @param name
	 * @return iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "HIBERNATE_STRATEGY" (null if no possible to determine strategy, otherwise return hibernate identifier strategy name/classname)
	 */
	public Iterator> getSuggestedPrimaryKeyStrategyName(String catalog, String schema, String table);

	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy