org.hibernate.cfg.reveng.dialect
Interface MetaDataDialect

All Known Implementing Classes:
AbstractMetaDataDialect, CachedMetaDataDialect, H2MetaDataDialect, JDBCMetaDataDialect, MySQLMetaDataDialect, OracleMetaDataDialect

public interface MetaDataDialect

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

Method Summary
 void close()
          Close any resources this dialect might have used.
 void close(Iterator iterator)
          Close the iterator.
 void configure(ReverseEngineeringRuntimeInfo info)
          Configure the metadatadialect.
 Iterator getColumns(String catalog, String schema, String table, String column)
          Return iterator over the columns that mathces catalog, schema and table
 Iterator getExportedKeys(String catalog, String schema, String table)
          Return iterator over the exported foreign keys that mathces catalog, schema and table
 Iterator getIndexInfo(String catalog, String schema, String table)
          Return iterator over the indexes that mathces catalog, schema and table
 Iterator getPrimaryKeys(String catalog, String schema, String name)
          Return iterator over the columns that mathces catalog, schema and table
 Iterator getSuggestedPrimaryKeyStrategyName(String catalog, String schema, String table)
          Use database (possible native) metadata to suggest identifier strategy.
 Iterator getTables(String catalog, String schema, String table)
          Return iterator over the tables that mathces catalog, schema and table
 boolean needQuote(String name)
          Does this name need quoting
 

Method Detail

configure

void configure(ReverseEngineeringRuntimeInfo info)
Configure the metadatadialect.

Parameters:
info - a ReverseEngineeringRuntimeInfo to extract Connection and SQLExceptionConverter and other runtime info

getTables

Iterator getTables(String catalog,
                   String schema,
                   String table)
Return iterator over the tables that mathces catalog, schema and table

Parameters:
catalog - name or null
schema - name or null
table - name or null
Returns:
iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "TABLE_TYPE" keys.

close

void close(Iterator iterator)
Close the iterator.

Parameters:
iterator - an iterator returned from one of methods on this dialect

getIndexInfo

Iterator getIndexInfo(String catalog,
                      String schema,
                      String table)
Return iterator over the indexes that mathces catalog, schema and table

Parameters:
catalog - name or null
schema - name or null
table - name or null
Returns:
iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "INDEX_NAME", "COLUMN_NAME", "NON_UNIQUE", "TYPE" keys.

getColumns

Iterator getColumns(String catalog,
                    String schema,
                    String table,
                    String column)
Return iterator over the columns that mathces catalog, schema and table

Parameters:
catalog - name or null
schema - name or null
table - name or null
column - name or null
Returns:
iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "DATA_TYPE", "TYPE_NAME", "COLUMN_NAME", "NULLABLE", "COLUMN_SIZE", "DECIMAL_DIGITS"

getPrimaryKeys

Iterator getPrimaryKeys(String catalog,
                        String schema,
                        String name)
Return iterator over the columns that mathces catalog, schema and table

Parameters:
catalog - name or null
schema - name or null
table - name or null
Returns:
iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "COLUMN_NAME", "KEY_SEQ", "PK_NAME",

getExportedKeys

Iterator getExportedKeys(String catalog,
                         String schema,
                         String table)
Return iterator over the exported foreign keys that mathces catalog, schema and table

Parameters:
catalog - name or null
schema - name or null
table - name or null
Returns:
iterator with map elements that has "TABLE_NAME", "TABLE_SCHEMA", "TABLE_CAT", "FKTABLE_CAT", "FKTABLE_SCHEM", "FKTABLE_NAME", "FK_NAME", "KEY_SEQ"

needQuote

boolean needQuote(String name)
Does this name need quoting

Parameters:
name -
Returns:

close

void close()
Close any resources this dialect might have used.


getSuggestedPrimaryKeyStrategyName

Iterator getSuggestedPrimaryKeyStrategyName(String catalog,
                                            String schema,
                                            String table)
Use database (possible native) metadata to suggest identifier strategy.

Parameters:
catalog -
schema -
name -
Returns:
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)