Package org.hibernate.tool.api.reveng
Interface RevengStrategy
- All Known Implementing Classes:
AbstractStrategy,DefaultStrategy,DelegatingStrategy,TableSelectorStrategy
public interface RevengStrategy
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionclassNameToCompositeIdName(String className) Given a class name return the name for its composite id if it will have one.voidclose()Close any resources this strategy might have used.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.columnToMetaAttributes(TableIdentifier identifier, String column) Return the list of metaattributes to assign to properties created based on the given columncolumnToPropertyName(TableIdentifier table, String column) Return a property name for a Column.booleanexcludeColumn(TableIdentifier identifier, String columnName) booleanexcludeForeignKeyAsCollection(String keyname, TableIdentifier fromTable, List<?> fromColumns, TableIdentifier referencedTable, List<?> referencedColumns) Should this foreignkey be excluded as a oneToManybooleanexcludeForeignKeyAsManytoOne(String keyname, TableIdentifier fromTable, List<?> fromColumns, TableIdentifier referencedTable, List<?> referencedColumns) Should this foreignkey be excluded as a many-to-onebooleanforeignKeyToAssociationInfo(org.hibernate.mapping.ForeignKey foreignKey) 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.foreignKeyToEntityName(String keyname, TableIdentifier fromTable, List<?> fromColumns, TableIdentifier referencedTable, List<?> referencedColumns, boolean uniqueReference) foreignKeyToInverseAssociationInfo(org.hibernate.mapping.ForeignKey foreignKey) foreignKeyToInverseEntityName(String keyname, TableIdentifier fromTable, List<?> fromColumns, TableIdentifier referencedTable, List<?> referencedColumns, boolean uniqueReference) Used to rename the inverse one-to-one properties.foreignKeyToManyToManyName(org.hibernate.mapping.ForeignKey fromKey, TableIdentifier middleTable, org.hibernate.mapping.ForeignKey toKey, boolean uniqueReference) List<org.hibernate.mapping.ForeignKey> getForeignKeys(TableIdentifier referencedTable) Gets the user defined foreign keys.getOptimisticLockColumnName(TableIdentifier identifier) Return explicit which column name should be used for optimistic lockgetPrimaryKeyColumnNames(TableIdentifier identifier) If a table does not have any primarykey columns reported, this method is called.Return list of SchemaSelctors to be used when askingRevengDialectfor metadata.getTableIdentifierProperties(TableIdentifier identifier) getTableIdentifierStrategyName(TableIdentifier identifier) booleanisForeignKeyCollectionInverse(String name, org.hibernate.mapping.Table foreignKeyTable, List<?> columns, org.hibernate.mapping.Table foreignKeyReferencedTable, List<?> referencedColumns) booleanisForeignKeyCollectionLazy(String name, TableIdentifier foreignKeyTable, List<?> columns, TableIdentifier foreignKeyReferencedTable, List<?> referencedColumns) is the collection lazy or not ?booleanisManyToManyTable(org.hibernate.mapping.Table table) booleanisOneToOne(org.hibernate.mapping.ForeignKey foreignKey) voidsetSettings(RevengSettings settings) Generic method used to initialize the reverse engineering strategy.tableToClassName(TableIdentifier tableIdentifier) tableToCompositeIdName(TableIdentifier identifier) Given a table name, return the wanted name for a composite identifier.tableToIdentifierPropertyName(TableIdentifier tableIdentifier) Given a table name, return the wanted name for the identifier.tableToMetaAttributes(TableIdentifier tableIdentifier) Return the list of metaattributes to assign to classes created based on the given tablebooleanuseColumnForOptimisticLock(TableIdentifier identifier, String column)
-
Method Details
-
setSettings
Generic method used to initialize the reverse engineering strategy.- Parameters:
settings- used for this
-
close
void close()Close any resources this strategy might have used. Called after reverse engineering has been completed. -
tableToClassName
- Returns:
- a fully-qualified class name
-
columnToPropertyName
Return a property name for a Column.- Parameters:
column- a columnname- Returns:
- a property name
-
excludeTable
-
excludeColumn
-
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 nullcolumnName- name of the column, can be nullsqlType- 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 columngeneratedIdentifier- true if for a column used in an identifier that is not "assigned", false otherwise.- Returns:
- The Preferred hibernate type name.
-
getForeignKeys
Gets the user defined foreign keys.- Parameters:
referencedTable- the table to get the foreign keys for- Returns:
- a list of ForeignKey's
-
getTableIdentifierStrategyName
- 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
-
getPrimaryKeyColumnNames
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
Given a class name return the name for its composite id if it will have one.- Parameters:
className-- Returns:
-
getOptimisticLockColumnName
Return explicit which column name should be used for optimistic lock -
useColumnForOptimisticLock
-
getSchemaSelections
List<RevengStrategy.SchemaSelection> getSchemaSelections()Return list of SchemaSelctors to be used when askingRevengDialectfor metadata.- Returns:
- list of
RevengStrategy.SchemaSelectioninstances
-
tableToIdentifierPropertyName
Given a table name, return the wanted name for the identifier.- Parameters:
tableIdentifier-- Returns:
- name to be used for identification
-
tableToCompositeIdName
Given a table name, return the wanted name for a composite identifier.- Parameters:
identifier-- Returns:
-
tableToMetaAttributes
Map<String,org.hibernate.mapping.MetaAttribute> 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<String,org.hibernate.mapping.MetaAttribute> columnToMetaAttributes(TableIdentifier identifier, String column) Return the list of metaattributes to assign to properties created based on the given column- Parameters:
column-tableIdentifier-- 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 -
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 correctreferencedColumns- list of Column instances on the referenced Table. Only col.getName() should be assumed to be correctuniqueReference- true if there is no other references to the same table- Returns:
-
foreignKeyToEntityName
String foreignKeyToEntityName(String keyname, TableIdentifier fromTable, List<?> fromColumns, TableIdentifier referencedTable, List<?> referencedColumns, boolean uniqueReference) - Parameters:
fromColumns- list of Column instances on the fromTable. Only col.getName() should be assumed to be correctreferencedColumns- list of Column instances on the referenced Table. Only col.getName() should be assumed to be correctuniqueReference- true if there is no other references to the same table- Returns:
-
foreignKeyToInverseEntityName
String foreignKeyToInverseEntityName(String keyname, TableIdentifier fromTable, List<?> fromColumns, TableIdentifier referencedTable, List<?> referencedColumns, 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 correctreferencedColumns- list of Column instances on the referenced Table. Only col.getName() should be assumed to be correctuniqueReference- 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 tablefromColumns- list of Column instances on the fromTable. Only col.getName() should be assumed to be correctreferencedColumns- 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) -
isForeignKeyCollectionInverse
-
foreignKeyToAssociationInfo
-
foreignKeyToInverseAssociationInfo
-