HHH-10430: Comment for class is ignored when using subselect in hibernate mapping - Solution

This commit is contained in:
Koen Aers 2016-01-11 11:16:48 +01:00 committed by Andrea Boriero
parent fd21be8705
commit ff3b54a962
5 changed files with 18 additions and 6 deletions

View File

@ -233,7 +233,8 @@ public class Helper {
: tableInformationContainer.getSubselect(),
tableInformationContainer.getTable() == null
? inLineViewNameInferrer.inferInLineViewName()
: tableInformationContainer.getTable()
: tableInformationContainer.getTable(),
comment
);
}
}

View File

@ -18,17 +18,21 @@ public class InLineViewSourceImpl
private final String catalogName;
private final String selectStatement;
private final String logicalName;
private final String comment;
public InLineViewSourceImpl(
MappingDocument mappingDocument,
String schemaName,
String catalogName,
String selectStatement, String logicalName) {
String selectStatement,
String logicalName,
String comment) {
super( mappingDocument );
this.schemaName = schemaName;
this.catalogName = catalogName;
this.selectStatement = selectStatement;
this.logicalName = logicalName;
this.comment = comment;
}
@Override
@ -50,4 +54,9 @@ public class InLineViewSourceImpl
public String getLogicalName() {
return logicalName;
}
@Override
public String getComment() {
return comment;
}
}

View File

@ -2895,11 +2895,12 @@ public class ModelBinder {
if ( isTable ) {
final TableSource tableSource = (TableSource) tableSpecSource;
table.setRowId( tableSource.getRowId() );
table.setComment( tableSource.getComment() );
if ( StringHelper.isNotEmpty( tableSource.getCheckConstraint() ) ) {
table.addCheckConstraint( tableSource.getCheckConstraint() );
}
}
}
table.setComment(tableSpecSource.getComment());
mappingDocument.getMetadataCollector().addTableNameBinding( logicalTableName, table );

View File

@ -21,7 +21,5 @@ public interface TableSource extends TableSpecificationSource {
String getRowId();
String getComment();
String getCheckConstraint();
}

View File

@ -25,4 +25,7 @@ public interface TableSpecificationSource {
* @return The catalog name. If {@code null}, the binder will apply the default.
*/
public String getExplicitCatalogName();
public String getComment();
}