HHH-10678 - Backport Fix hbm hibernate-mapping's schema attribute is ignored

This commit is contained in:
Andrea Boriero 2016-04-12 11:45:32 +01:00
parent f20b3417d5
commit 2d903875d7
2 changed files with 20 additions and 4 deletions

View File

@ -25,8 +25,8 @@ public class InLineViewSourceImpl
String catalogName,
String selectStatement, String logicalName) {
super( mappingDocument );
this.schemaName = schemaName;
this.catalogName = catalogName;
this.schemaName = determineSchemaName( mappingDocument, schemaName );
this.catalogName = determineCatalogName( mappingDocument, catalogName );
this.selectStatement = selectStatement;
this.logicalName = logicalName;
}
@ -50,4 +50,12 @@ public class InLineViewSourceImpl
public String getLogicalName() {
return logicalName;
}
private String determineCatalogName(MappingDocument mappingDocument, String catalogName) {
return catalogName != null ? catalogName : mappingDocument.getDocumentRoot().getCatalog();
}
private String determineSchemaName(MappingDocument mappingDocument, String schemaName) {
return schemaName != null ? schemaName : mappingDocument.getDocumentRoot().getSchema();
}
}

View File

@ -30,8 +30,8 @@ public class TableSourceImpl extends AbstractHbmSourceNode implements TableSourc
String comment,
String checkConstraint) {
super( mappingDocument );
this.explicitCatalog = explicitCatalog;
this.explicitSchema = explicitSchema;
this.explicitCatalog = determineCatalogName( mappingDocument, explicitCatalog );;
this.explicitSchema = determineSchemaName( mappingDocument, explicitSchema );;
this.explicitTableName = explicitTableName;
this.rowId = rowId;
this.comment = comment;
@ -67,4 +67,12 @@ public class TableSourceImpl extends AbstractHbmSourceNode implements TableSourc
public String getCheckConstraint() {
return checkConstraint;
}
private String determineCatalogName(MappingDocument mappingDocument, String catalogName) {
return catalogName != null ? catalogName : mappingDocument.getDocumentRoot().getCatalog();
}
private String determineSchemaName(MappingDocument mappingDocument, String schemaName) {
return schemaName != null ? schemaName : mappingDocument.getDocumentRoot().getSchema();
}
}