org.hibernate.cfg.reveng
Interface ReverseEngineeringStrategy

All Known Implementing Classes:
DefaultReverseEngineeringStrategy, DelegatingReverseEngineeringStrategy, TableSelectorStrategy

public interface ReverseEngineeringStrategy


Method Summary
 String classNameToCompositeIdName(String className)
          Given a class name return the name for its composite id if it will have one.
 void close()
          Close any resources this strategy might have used.
 String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable, boolean generatedIdentifier)
          Gets the preferred Hibernate type for an SQL type.
 Map columnToMetaAttributes(TableIdentifier identifier, String column)
          Return the list of metaattributes to assign to properties created based on the given column
 String columnToPropertyName(TableIdentifier table, String column)
          Return a property name for a Column.
 void configure(ReverseEngineeringRuntimeInfo runtimeInfo)
          Configure the reverse engineering strategy.
 boolean excludeColumn(TableIdentifier identifier, String columnName)
           
 boolean excludeForeignKeyAsCollection(String keyname, TableIdentifier fromTable, List fromColumns, TableIdentifier referencedTable, List referencedColumns)
          Should this foreignkey be excluded as a oneToMany
 boolean excludeForeignKeyAsManytoOne(String keyname, TableIdentifier fromTable, List fromColumns, TableIdentifier referencedTable, List referencedColumns)
          Should this foreignkey be excluded as a many-to-one
 boolean excludeTable(TableIdentifier ti)
           
 AssociationInfo foreignKeyToAssociationInfo(org.hibernate.mapping.ForeignKey foreignKey)
           
 String foreignKeyToCollectionName(String keyname, TableIdentifier fromTable, List fromColumns, TableIdentifier referencedTable, List referencedColumns, boolean uniqueReference)
          Return a collection role name for a Collection based on the foreignkey.
 String foreignKeyToEntityName(String keyname, TableIdentifier fromTable, List fromColumnNames, TableIdentifier referencedTable, List referencedColumnNames, boolean uniqueReference)
           
 AssociationInfo foreignKeyToInverseAssociationInfo(org.hibernate.mapping.ForeignKey foreignKey)
           
 String foreignKeyToInverseEntityName(String keyname, TableIdentifier fromTable, List fromColumnNames, TableIdentifier referencedTable, List referencedColumnNames, boolean uniqueReference)
          Used to rename the inverse one-to-one properties.
 String foreignKeyToManyToManyName(org.hibernate.mapping.ForeignKey fromKey, TableIdentifier middleTable, org.hibernate.mapping.ForeignKey toKey, boolean uniqueReference)
           
 List getForeignKeys(TableIdentifier referencedTable)
          Gets the user defined foreign keys.
 String getOptimisticLockColumnName(TableIdentifier identifier)
          Return explicit which column name should be used for optimistic lock
 List getPrimaryKeyColumnNames(TableIdentifier identifier)
          If a table does not have any primarykey columns reported, this method is called.
 List getSchemaSelections()
          Return list of SchemaSelctors to be used when asking MetaDataDialect for metadata.
 Properties getTableIdentifierProperties(TableIdentifier identifier)
           
 String getTableIdentifierStrategyName(TableIdentifier identifier)
           
 boolean isForeignKeyCollectionInverse(String name, TableIdentifier foreignKeyTable, List columns, TableIdentifier foreignKeyReferencedTable, List referencedColumns)
          is the collection inverse or not ?
 boolean isForeignKeyCollectionLazy(String name, TableIdentifier foreignKeyTable, List columns, TableIdentifier foreignKeyReferencedTable, List referencedColumns)
          is the collection lazy or not ?
 boolean isManyToManyTable(org.hibernate.mapping.Table table)
           
 boolean isOneToOne(org.hibernate.mapping.ForeignKey foreignKey)
           
 void setSettings(ReverseEngineeringSettings settings)
          Generic method used to initialize the reverse engineering strategy.
 String tableToClassName(TableIdentifier tableIdentifier)
           
 String tableToCompositeIdName(TableIdentifier identifier)
          Given a table name, return the wanted name for a composite identifier.
 String tableToIdentifierPropertyName(TableIdentifier tableIdentifier)
          Given a table name, return the wanted name for the identifier.
 Map tableToMetaAttributes(TableIdentifier tableIdentifier)
          Return the list of metaattributes to assign to classes created based on the given table
 boolean useColumnForOptimisticLock(TableIdentifier identifier, String column)
           
 

Method Detail

setSettings

void setSettings(ReverseEngineeringSettings settings)
Generic method used to initialize the reverse engineering strategy.

Parameters:
settings - used for this

configure

void configure(ReverseEngineeringRuntimeInfo runtimeInfo)
Configure the reverse engineering strategy. Called before reverse engineering commences. This is mainly for exotic strategies to get access to a connection.

Parameters:
runtimeInfo -

close

void close()
Close any resources this strategy might have used. Called after reverse engineering has been completed.


tableToClassName

String tableToClassName(TableIdentifier tableIdentifier)
Returns:
a fully-qualified class name

columnToPropertyName

String columnToPropertyName(TableIdentifier table,
                            String column)
Return a property name for a Column.

Parameters:
column - a columnname
Returns:
a property name

excludeTable

boolean excludeTable(TableIdentifier ti)

excludeColumn

boolean excludeColumn(TableIdentifier identifier,
                      String columnName)

columnToHibernateTypeName

String columnToHibernateTypeName(TableIdentifier table,
                                 String columnName,
                                 int sqlType,
                                 int length,
                                 int precision,
                                 int scale,
                                 boolean nullable,
                                 boolean generatedIdentifier)
Gets the preferred Hibernate type for an SQL type.

Parameters:
table - name of the table, can be null
columnName - name of the column, can be null
sqlType - The sql type.
length - The length of the column.
precision - The number of decimal digits, if applicable.
scale - The scale, if applicable.
nullable - The nullability of the column
generatedIdentifier - true if for a column used in an identifier that is not "assigned", false otherwise.
Returns:
The Preferred hibernate type name.

getForeignKeys

List getForeignKeys(TableIdentifier referencedTable)
Gets the user defined foreign keys.

Parameters:
referencedTable - TODO
identifier -
Returns:
a list of ForeignKey's

getTableIdentifierStrategyName

String getTableIdentifierStrategyName(TableIdentifier identifier)
Parameters:
identifier - the table to look up for
Returns:
the identifier strategy name wanted for a specific table, null if use what the database metadata can tell.

getTableIdentifierProperties

Properties getTableIdentifierProperties(TableIdentifier identifier)

getPrimaryKeyColumnNames

List getPrimaryKeyColumnNames(TableIdentifier identifier)
If a table does not have any primarykey columns reported, this method is called.

Returns:
list of strings for each column name that is part of the primary key

classNameToCompositeIdName

String classNameToCompositeIdName(String className)
Given a class name return the name for its composite id if it will have one.

Parameters:
className -
Returns:

getOptimisticLockColumnName

String getOptimisticLockColumnName(TableIdentifier identifier)
Return explicit which column name should be used for optimistic lock


useColumnForOptimisticLock

boolean useColumnForOptimisticLock(TableIdentifier identifier,
                                   String column)

getSchemaSelections

List getSchemaSelections()
Return list of SchemaSelctors to be used when asking MetaDataDialect for metadata.

Returns:
list of SchemaSelection instances

tableToIdentifierPropertyName

String tableToIdentifierPropertyName(TableIdentifier tableIdentifier)
Given a table name, return the wanted name for the identifier.

Parameters:
tableIdentifier -
Returns:
name to be used for identification

tableToCompositeIdName

String tableToCompositeIdName(TableIdentifier identifier)
Given a table name, return the wanted name for a composite identifier.

Parameters:
identifier -
Returns:

tableToMetaAttributes

Map tableToMetaAttributes(TableIdentifier tableIdentifier)
Return the list of metaattributes to assign to classes created based on the given table

Parameters:
tableIdentifier -
Returns:
a Map from String to MetaAttribute

columnToMetaAttributes

Map columnToMetaAttributes(TableIdentifier identifier,
                           String column)
Return the list of metaattributes to assign to properties created based on the given column

Parameters:
tableIdentifier -
column -
Returns:
a Map from String to MetaAttribute

excludeForeignKeyAsCollection

boolean excludeForeignKeyAsCollection(String keyname,
                                      TableIdentifier fromTable,
                                      List fromColumns,
                                      TableIdentifier referencedTable,
                                      List referencedColumns)
Should this foreignkey be excluded as a oneToMany


excludeForeignKeyAsManytoOne

boolean excludeForeignKeyAsManytoOne(String keyname,
                                     TableIdentifier fromTable,
                                     List fromColumns,
                                     TableIdentifier referencedTable,
                                     List referencedColumns)
Should this foreignkey be excluded as a many-to-one


isForeignKeyCollectionInverse

boolean isForeignKeyCollectionInverse(String name,
                                      TableIdentifier foreignKeyTable,
                                      List columns,
                                      TableIdentifier foreignKeyReferencedTable,
                                      List referencedColumns)
is the collection inverse or not ?


isForeignKeyCollectionLazy

boolean isForeignKeyCollectionLazy(String name,
                                   TableIdentifier foreignKeyTable,
                                   List columns,
                                   TableIdentifier foreignKeyReferencedTable,
                                   List referencedColumns)
is the collection lazy or not ?


foreignKeyToCollectionName

String foreignKeyToCollectionName(String keyname,
                                  TableIdentifier fromTable,
                                  List fromColumns,
                                  TableIdentifier referencedTable,
                                  List referencedColumns,
                                  boolean uniqueReference)
Return a collection role name for a Collection based on the foreignkey.

Parameters:
fromColumns - list of Column instances on the fromTable. Only col.getName() should be assumed to be correct
referencedColumns - list of Column instances on the referenced Table. Only col.getName() should be assumed to be correct
uniqueReference - true if there is no other references to the same table
Returns:

foreignKeyToEntityName

String foreignKeyToEntityName(String keyname,
                              TableIdentifier fromTable,
                              List fromColumnNames,
                              TableIdentifier referencedTable,
                              List referencedColumnNames,
                              boolean uniqueReference)
Parameters:
fromColumns - list of Column instances on the fromTable. Only col.getName() should be assumed to be correct
referencedColumns - list of Column instances on the referenced Table. Only col.getName() should be assumed to be correct
uniqueReference - true if there is no other references to the same table
Returns:

foreignKeyToInverseEntityName

String foreignKeyToInverseEntityName(String keyname,
                                     TableIdentifier fromTable,
                                     List fromColumnNames,
                                     TableIdentifier referencedTable,
                                     List referencedColumnNames,
                                     boolean uniqueReference)
Used to rename the inverse one-to-one properties.

Parameters:
fromColumns - list of Column instances on the fromTable. Only col.getName() should be assumed to be correct
referencedColumns - list of Column instances on the referenced Table. Only col.getName() should be assumed to be correct
uniqueReference - true if there is no other references to the same table
Returns:
null if use defaults or non-empty String with a specific name

isManyToManyTable

boolean isManyToManyTable(org.hibernate.mapping.Table table)
Parameters:
table -
Returns:
true if this table is considered to be a many-to-many table.

foreignKeyToManyToManyName

String foreignKeyToManyToManyName(org.hibernate.mapping.ForeignKey fromKey,
                                  TableIdentifier middleTable,
                                  org.hibernate.mapping.ForeignKey toKey,
                                  boolean uniqueReference)
Parameters:
middleTable -
uniqueReference - true if there is no other references to the same table
fromColumns - list of Column instances on the fromTable. Only col.getName() should be assumed to be correct
referencedColumns - list of Column instances on the referenced Table. Only col.getName() should be assumed to be correct
Returns:

isOneToOne

boolean isOneToOne(org.hibernate.mapping.ForeignKey foreignKey)

foreignKeyToAssociationInfo

AssociationInfo foreignKeyToAssociationInfo(org.hibernate.mapping.ForeignKey foreignKey)

foreignKeyToInverseAssociationInfo

AssociationInfo foreignKeyToInverseAssociationInfo(org.hibernate.mapping.ForeignKey foreignKey)