HHH-3888, ENVERS-70:
- copying the scale, precision and sql-type attributes to the column definition git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@16483 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
21aaac2ea4
commit
1553578808
|
@ -76,11 +76,11 @@ public class RevisionInfoConfiguration {
|
||||||
|
|
||||||
Element idProperty = MetadataTools.addNativelyGeneratedId(class_mapping, revisionInfoIdData.getName(),
|
Element idProperty = MetadataTools.addNativelyGeneratedId(class_mapping, revisionInfoIdData.getName(),
|
||||||
revisionPropType);
|
revisionPropType);
|
||||||
MetadataTools.addColumn(idProperty, "REV", null);
|
MetadataTools.addColumn(idProperty, "REV", null, 0, 0, null);
|
||||||
|
|
||||||
Element timestampProperty = MetadataTools.addProperty(class_mapping, revisionInfoTimestampData.getName(),
|
Element timestampProperty = MetadataTools.addProperty(class_mapping, revisionInfoTimestampData.getName(),
|
||||||
revisionInfoTimestampType, true, false);
|
revisionInfoTimestampType, true, false);
|
||||||
MetadataTools.addColumn(timestampProperty, "REVTSTMP", null);
|
MetadataTools.addColumn(timestampProperty, "REVTSTMP", null, 0, 0, null);
|
||||||
|
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public final class AuditMetadataGenerator {
|
||||||
void addRevisionInfoRelation(Element any_mapping) {
|
void addRevisionInfoRelation(Element any_mapping) {
|
||||||
Element rev_mapping = (Element) revisionInfoRelationMapping.clone();
|
Element rev_mapping = (Element) revisionInfoRelationMapping.clone();
|
||||||
rev_mapping.addAttribute("name", verEntCfg.getRevisionFieldName());
|
rev_mapping.addAttribute("name", verEntCfg.getRevisionFieldName());
|
||||||
MetadataTools.addColumn(rev_mapping, verEntCfg.getRevisionFieldName(), null);
|
MetadataTools.addColumn(rev_mapping, verEntCfg.getRevisionFieldName(), null, 0, 0, null);
|
||||||
|
|
||||||
any_mapping.add(rev_mapping);
|
any_mapping.add(rev_mapping);
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ public final class AuditMetadataGenerator {
|
||||||
|
|
||||||
Element joinKey = joinElement.addElement("key");
|
Element joinKey = joinElement.addElement("key");
|
||||||
MetadataTools.addColumns(joinKey, join.getKey().getColumnIterator());
|
MetadataTools.addColumns(joinKey, join.getKey().getColumnIterator());
|
||||||
MetadataTools.addColumn(joinKey, verEntCfg.getRevisionFieldName(), null);
|
MetadataTools.addColumn(joinKey, verEntCfg.getRevisionFieldName(), null, 0, 0, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ public final class AuditMetadataGenerator {
|
||||||
// Adding the "key" element with all columns + the revision number column
|
// Adding the "key" element with all columns + the revision number column
|
||||||
Element keyMapping = mappingData.getFirst().addElement("key");
|
Element keyMapping = mappingData.getFirst().addElement("key");
|
||||||
MetadataTools.addColumns(keyMapping, pc.getIdentifierProperty().getColumnIterator());
|
MetadataTools.addColumns(keyMapping, pc.getIdentifierProperty().getColumnIterator());
|
||||||
MetadataTools.addColumn(keyMapping, verEntCfg.getRevisionFieldName(), null);
|
MetadataTools.addColumn(keyMapping, verEntCfg.getRevisionFieldName(), null, 0, 0, null);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TABLE_PER_CLASS:
|
case TABLE_PER_CLASS:
|
||||||
|
|
|
@ -68,13 +68,23 @@ public class MetadataTools {
|
||||||
return prop_mapping;
|
return prop_mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Element addColumn(Element parent, String name, Integer length) {
|
public static Element addColumn(Element parent, String name, Integer length, Integer scale, Integer precision,
|
||||||
|
String sqlType) {
|
||||||
Element column_mapping = parent.addElement("column");
|
Element column_mapping = parent.addElement("column");
|
||||||
|
|
||||||
column_mapping.addAttribute("name", name);
|
column_mapping.addAttribute("name", name);
|
||||||
if (length != null) {
|
if (length != null) {
|
||||||
column_mapping.addAttribute("length", length.toString());
|
column_mapping.addAttribute("length", length.toString());
|
||||||
}
|
}
|
||||||
|
if (scale != 0) {
|
||||||
|
column_mapping.addAttribute("scale", Integer.toString(scale));
|
||||||
|
}
|
||||||
|
if (precision != 0) {
|
||||||
|
column_mapping.addAttribute("precision", Integer.toString(precision));
|
||||||
|
}
|
||||||
|
if (sqlType != null) {
|
||||||
|
column_mapping.addAttribute("sql-type", sqlType);
|
||||||
|
}
|
||||||
|
|
||||||
return column_mapping;
|
return column_mapping;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +152,8 @@ public class MetadataTools {
|
||||||
public static void addColumns(Element any_mapping, Iterator<Column> columns) {
|
public static void addColumns(Element any_mapping, Iterator<Column> columns) {
|
||||||
while (columns.hasNext()) {
|
while (columns.hasNext()) {
|
||||||
Column column = columns.next();
|
Column column = columns.next();
|
||||||
addColumn(any_mapping, column.getName(), column.getLength());
|
addColumn(any_mapping, column.getName(), column.getLength(), column.getScale(), column.getPrecision(),
|
||||||
|
column.getSqlType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue