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 logicalName,
String comment) { String comment) {
super( mappingDocument ); super( mappingDocument );
this.schemaName = schemaName; this.schemaName = determineSchemaName( mappingDocument, schemaName );
this.catalogName = catalogName; this.catalogName = determineCatalogName( mappingDocument, catalogName );
this.selectStatement = selectStatement; this.selectStatement = selectStatement;
this.logicalName = logicalName; this.logicalName = logicalName;
this.comment = comment; this.comment = comment;
@ -59,4 +59,12 @@ public class InLineViewSourceImpl
public String getComment() { public String getComment() {
return comment; 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 comment,
String checkConstraint) { String checkConstraint) {
super( mappingDocument ); super( mappingDocument );
this.explicitCatalog = explicitCatalog; this.explicitCatalog = determineCatalogName( mappingDocument, explicitCatalog );;
this.explicitSchema = explicitSchema; this.explicitSchema = determineSchemaName( mappingDocument, explicitSchema );;
this.explicitTableName = explicitTableName; this.explicitTableName = explicitTableName;
this.rowId = rowId; this.rowId = rowId;
this.comment = comment; this.comment = comment;
@ -67,4 +67,12 @@ public class TableSourceImpl extends AbstractHbmSourceNode implements TableSourc
public String getCheckConstraint() { public String getCheckConstraint() {
return checkConstraint; 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();
}
} }