HHH-10678 - 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 d6db50897a
commit b6d010c07a
2 changed files with 20 additions and 4 deletions

View File

@ -28,8 +28,8 @@ public class InLineViewSourceImpl
String logicalName,
String comment) {
super( mappingDocument );
this.schemaName = schemaName;
this.catalogName = catalogName;
this.schemaName = determineSchemaName( mappingDocument, schemaName );
this.catalogName = determineCatalogName( mappingDocument, catalogName );
this.selectStatement = selectStatement;
this.logicalName = logicalName;
this.comment = comment;
@ -59,4 +59,12 @@ public class InLineViewSourceImpl
public String getComment() {
return comment;
}
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();
}
}