Class DelegatingStrategy
java.lang.Object
org.hibernate.tool.internal.reveng.strategy.DelegatingStrategy
- All Implemented Interfaces:
RevengStrategy
- Direct Known Subclasses:
TableSelectorStrategy
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.tool.api.reveng.RevengStrategy
RevengStrategy.SchemaSelection -
Constructor Summary
Constructors -
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<?> fromColumnNames, TableIdentifier referencedTable, List<?> referencedColumnNames, boolean uniqueReference) foreignKeyToInverseAssociationInfo(org.hibernate.mapping.ForeignKey foreignKey) foreignKeyToInverseEntityName(String keyname, TableIdentifier fromTable, List<?> fromColumnNames, TableIdentifier referencedTable, List<?> referencedColumnNames, 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 tableIdentifier) 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) Initialize the settings.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)
-
Constructor Details
-
DelegatingStrategy
-
-
Method Details
-
getForeignKeys
Description copied from interface:RevengStrategyGets the user defined foreign keys.- Specified by:
getForeignKeysin interfaceRevengStrategy- Parameters:
referencedTable- the table to get the foreign keys for- Returns:
- a list of ForeignKey's
-
columnToPropertyName
Description copied from interface:RevengStrategyReturn a property name for a Column.- Specified by:
columnToPropertyNamein interfaceRevengStrategy- Parameters:
column- a columnname- Returns:
- a property name
-
excludeTable
- Specified by:
excludeTablein interfaceRevengStrategy
-
excludeColumn
- Specified by:
excludeColumnin interfaceRevengStrategy
-
foreignKeyToCollectionName
public String foreignKeyToCollectionName(String keyname, TableIdentifier fromTable, List<?> fromColumns, TableIdentifier referencedTable, List<?> referencedColumns, boolean uniqueReference) Description copied from interface:RevengStrategyReturn a collection role name for a Collection based on the foreignkey.- Specified by:
foreignKeyToCollectionNamein interfaceRevengStrategy- 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
public String foreignKeyToEntityName(String keyname, TableIdentifier fromTable, List<?> fromColumnNames, TableIdentifier referencedTable, List<?> referencedColumnNames, boolean uniqueReference) - Specified by:
foreignKeyToEntityNamein interfaceRevengStrategy- Parameters:
fromColumnNames- list of Column instances on the fromTable. Only col.getName() should be assumed to be correctreferencedColumnNames- 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:
-
columnToHibernateTypeName
public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable, boolean generatedIdentifier) Description copied from interface:RevengStrategyGets the preferred Hibernate type for an SQL type.- Specified by:
columnToHibernateTypeNamein interfaceRevengStrategy- 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.
-
tableToClassName
- Specified by:
tableToClassNamein interfaceRevengStrategy- Returns:
- a fully-qualified class name
-
getTableIdentifierStrategyName
- Specified by:
getTableIdentifierStrategyNamein interfaceRevengStrategy- Parameters:
tableIdentifier- 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
- Specified by:
getTableIdentifierPropertiesin interfaceRevengStrategy
-
getPrimaryKeyColumnNames
Description copied from interface:RevengStrategyIf a table does not have any primarykey columns reported, this method is called.- Specified by:
getPrimaryKeyColumnNamesin interfaceRevengStrategy- Returns:
- list of strings for each column name that is part of the primary key
-
classNameToCompositeIdName
Description copied from interface:RevengStrategyGiven a class name return the name for its composite id if it will have one.- Specified by:
classNameToCompositeIdNamein interfaceRevengStrategy- Parameters:
className-- Returns:
-
close
public void close()Description copied from interface:RevengStrategyClose any resources this strategy might have used. Called after reverse engineering has been completed.- Specified by:
closein interfaceRevengStrategy
-
getOptimisticLockColumnName
Description copied from interface:RevengStrategyReturn explicit which column name should be used for optimistic lock- Specified by:
getOptimisticLockColumnNamein interfaceRevengStrategy
-
useColumnForOptimisticLock
- Specified by:
useColumnForOptimisticLockin interfaceRevengStrategy
-
getSchemaSelections
Description copied from interface:RevengStrategyReturn list of SchemaSelctors to be used when askingRevengDialectfor metadata.- Specified by:
getSchemaSelectionsin interfaceRevengStrategy- Returns:
- list of
RevengStrategy.SchemaSelectioninstances
-
tableToIdentifierPropertyName
Description copied from interface:RevengStrategyGiven a table name, return the wanted name for the identifier.- Specified by:
tableToIdentifierPropertyNamein interfaceRevengStrategy- Parameters:
tableIdentifier-- Returns:
- name to be used for identification
-
tableToCompositeIdName
Description copied from interface:RevengStrategyGiven a table name, return the wanted name for a composite identifier.- Specified by:
tableToCompositeIdNamein interfaceRevengStrategy- Parameters:
identifier-- Returns:
-
excludeForeignKeyAsCollection
public boolean excludeForeignKeyAsCollection(String keyname, TableIdentifier fromTable, List<?> fromColumns, TableIdentifier referencedTable, List<?> referencedColumns) Description copied from interface:RevengStrategyShould this foreignkey be excluded as a oneToMany- Specified by:
excludeForeignKeyAsCollectionin interfaceRevengStrategy
-
excludeForeignKeyAsManytoOne
public boolean excludeForeignKeyAsManytoOne(String keyname, TableIdentifier fromTable, List<?> fromColumns, TableIdentifier referencedTable, List<?> referencedColumns) Description copied from interface:RevengStrategyShould this foreignkey be excluded as a many-to-one- Specified by:
excludeForeignKeyAsManytoOnein interfaceRevengStrategy
-
isForeignKeyCollectionInverse
public boolean isForeignKeyCollectionInverse(String name, org.hibernate.mapping.Table foreignKeyTable, List<?> columns, org.hibernate.mapping.Table foreignKeyReferencedTable, List<?> referencedColumns) - Specified by:
isForeignKeyCollectionInversein interfaceRevengStrategy
-
isForeignKeyCollectionLazy
public boolean isForeignKeyCollectionLazy(String name, TableIdentifier foreignKeyTable, List<?> columns, TableIdentifier foreignKeyReferencedTable, List<?> referencedColumns) Description copied from interface:RevengStrategyis the collection lazy or not ?- Specified by:
isForeignKeyCollectionLazyin interfaceRevengStrategy
-
setSettings
Initialize the settings. If subclasses need to use the Settings then it should keep its own reference, but still remember to initialize the delegates settings by calling super.setSettings(settings).- Specified by:
setSettingsin interfaceRevengStrategy- Parameters:
settings- used for this- See Also:
-
isManyToManyTable
public boolean isManyToManyTable(org.hibernate.mapping.Table table) - Specified by:
isManyToManyTablein interfaceRevengStrategy- Parameters:
table-- Returns:
- true if this table is considered to be a many-to-many table.
-
isOneToOne
public boolean isOneToOne(org.hibernate.mapping.ForeignKey foreignKey) - Specified by:
isOneToOnein interfaceRevengStrategy
-
foreignKeyToManyToManyName
public String foreignKeyToManyToManyName(org.hibernate.mapping.ForeignKey fromKey, TableIdentifier middleTable, org.hibernate.mapping.ForeignKey toKey, boolean uniqueReference) - Specified by:
foreignKeyToManyToManyNamein interfaceRevengStrategy- Parameters:
middleTable-uniqueReference- true if there is no other references to the same table- Returns:
-
tableToMetaAttributes
public Map<String,org.hibernate.mapping.MetaAttribute> tableToMetaAttributes(TableIdentifier tableIdentifier) Description copied from interface:RevengStrategyReturn the list of metaattributes to assign to classes created based on the given table- Specified by:
tableToMetaAttributesin interfaceRevengStrategy- Parameters:
tableIdentifier-- Returns:
- a Map from String to
MetaAttribute
-
columnToMetaAttributes
public Map<String,org.hibernate.mapping.MetaAttribute> columnToMetaAttributes(TableIdentifier identifier, String column) Description copied from interface:RevengStrategyReturn the list of metaattributes to assign to properties created based on the given column- Specified by:
columnToMetaAttributesin interfaceRevengStrategy- Parameters:
column-- Returns:
- a Map from String to
MetaAttribute
-
foreignKeyToAssociationInfo
- Specified by:
foreignKeyToAssociationInfoin interfaceRevengStrategy
-
foreignKeyToInverseAssociationInfo
public AssociationInfo foreignKeyToInverseAssociationInfo(org.hibernate.mapping.ForeignKey foreignKey) - Specified by:
foreignKeyToInverseAssociationInfoin interfaceRevengStrategy
-
foreignKeyToInverseEntityName
public String foreignKeyToInverseEntityName(String keyname, TableIdentifier fromTable, List<?> fromColumnNames, TableIdentifier referencedTable, List<?> referencedColumnNames, boolean uniqueReference) Description copied from interface:RevengStrategyUsed to rename the inverse one-to-one properties.- Specified by:
foreignKeyToInverseEntityNamein interfaceRevengStrategy- Parameters:
fromColumnNames- list of Column instances on the fromTable. Only col.getName() should be assumed to be correctreferencedColumnNames- 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
-