HHH-12935 : Constraint and AuxiliaryDatabaseObject export identifiers are not qualified by schema or catalog
(cherry picked from commit 4d381457c5
)
This commit is contained in:
parent
d166de919b
commit
5e8646e3bd
|
@ -8,6 +8,8 @@ package org.hibernate.boot.model.relational;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.boot.model.naming.Identifier;
|
||||
|
||||
/**
|
||||
* Mainly this is used to support legacy sequence exporting.
|
||||
*
|
||||
|
@ -42,6 +44,10 @@ public class NamedAuxiliaryDatabaseObject
|
|||
|
||||
@Override
|
||||
public String getExportIdentifier() {
|
||||
return name;
|
||||
return new QualifiedNameImpl(
|
||||
Identifier.toIdentifier( getCatalogName() ),
|
||||
Identifier.toIdentifier( getSchemaName() ),
|
||||
Identifier.toIdentifier( name )
|
||||
).render();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,14 @@ public class SimpleAuxiliaryDatabaseObject extends AbstractAuxiliaryDatabaseObje
|
|||
return copy;
|
||||
}
|
||||
|
||||
protected String getCatalogName() {
|
||||
return catalogName;
|
||||
}
|
||||
|
||||
protected String getSchemaName() {
|
||||
return schemaName;
|
||||
}
|
||||
|
||||
private String injectCatalogAndSchema(String ddlString) {
|
||||
String rtn = StringHelper.replace( ddlString, CATALOG_NAME_PLACEHOLDER, catalogName == null ? "" : catalogName );
|
||||
rtn = StringHelper.replace( rtn, SCHEMA_NAME_PLACEHOLDER, schemaName == null ? "" : schemaName );
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ForeignKey extends Constraint {
|
|||
@Override
|
||||
public String getExportIdentifier() {
|
||||
// NOt sure name is always set. Might need some implicit naming
|
||||
return StringHelper.qualify( getTable().getName(), "FK-" + getName() );
|
||||
return StringHelper.qualify( getTable().getExportIdentifier(), "FK-" + getName() );
|
||||
}
|
||||
|
||||
public void disableCreation() {
|
||||
|
|
|
@ -234,6 +234,6 @@ public class Index implements RelationalModel, Exportable, Serializable {
|
|||
|
||||
@Override
|
||||
public String getExportIdentifier() {
|
||||
return StringHelper.qualify( getTable().getName(), "IDX-" + getName() );
|
||||
return StringHelper.qualify( getTable().getExportIdentifier(), "IDX-" + getName() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,6 @@ public class PrimaryKey extends Constraint {
|
|||
|
||||
@Override
|
||||
public String getExportIdentifier() {
|
||||
return StringHelper.qualify( getTable().getName(), "PK-" + getName() );
|
||||
return StringHelper.qualify( getTable().getExportIdentifier(), "PK-" + getName() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,6 @@ public class UniqueKey extends Constraint {
|
|||
|
||||
@Override
|
||||
public String getExportIdentifier() {
|
||||
return StringHelper.qualify( getTable().getName(), "UK-" + getName() );
|
||||
return StringHelper.qualify( getTable().getExportIdentifier(), "UK-" + getName() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue