HHH-12935 : Constraint and AuxiliaryDatabaseObject export identifiers are not qualified by schema or catalog
This commit is contained in:
parent
e3726bc4db
commit
ba80f0b3dc
|
@ -8,6 +8,8 @@ package org.hibernate.boot.model.relational;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mainly this is used to support legacy sequence exporting.
|
* Mainly this is used to support legacy sequence exporting.
|
||||||
*
|
*
|
||||||
|
@ -42,6 +44,10 @@ public class NamedAuxiliaryDatabaseObject
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getExportIdentifier() {
|
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;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getCatalogName() {
|
||||||
|
return catalogName;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getSchemaName() {
|
||||||
|
return schemaName;
|
||||||
|
}
|
||||||
|
|
||||||
private String injectCatalogAndSchema(String ddlString) {
|
private String injectCatalogAndSchema(String ddlString) {
|
||||||
String rtn = StringHelper.replace( ddlString, CATALOG_NAME_PLACEHOLDER, catalogName == null ? "" : catalogName );
|
String rtn = StringHelper.replace( ddlString, CATALOG_NAME_PLACEHOLDER, catalogName == null ? "" : catalogName );
|
||||||
rtn = StringHelper.replace( rtn, SCHEMA_NAME_PLACEHOLDER, schemaName == null ? "" : schemaName );
|
rtn = StringHelper.replace( rtn, SCHEMA_NAME_PLACEHOLDER, schemaName == null ? "" : schemaName );
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class ForeignKey extends Constraint {
|
||||||
@Override
|
@Override
|
||||||
public String getExportIdentifier() {
|
public String getExportIdentifier() {
|
||||||
// NOt sure name is always set. Might need some implicit naming
|
// 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() {
|
public void disableCreation() {
|
||||||
|
|
|
@ -238,6 +238,6 @@ public class Index implements RelationalModel, Exportable, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getExportIdentifier() {
|
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
|
@Override
|
||||||
public String getExportIdentifier() {
|
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
|
@Override
|
||||||
public String getExportIdentifier() {
|
public String getExportIdentifier() {
|
||||||
return StringHelper.qualify( getTable().getName(), "UK-" + getName() );
|
return StringHelper.qualify( getTable().getExportIdentifier(), "UK-" + getName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue