fix @Column(precision=p) with TimeZoneStorageType.COLUMN

This commit is contained in:
Gavin 2022-12-07 13:44:21 +01:00 committed by Gavin King
parent cceac72a22
commit 512ad8c80d
1 changed files with 39 additions and 34 deletions

View File

@ -525,11 +525,17 @@ public abstract class AbstractPropertyHolder implements PropertyHolder {
}
private static Column createTimestampColumn(XAnnotatedElement element, String path, MetadataBuildingContext context) {
int precision;
final Column annotatedColumn = element.getAnnotation( Column.class );
if ( annotatedColumn != null ) {
if ( !annotatedColumn.name().isEmpty() ) {
return annotatedColumn;
}
precision = annotatedColumn.precision();
}
else {
precision = 0;
}
// Base the name of the synthetic dateTime field on the name of the original attribute
final Identifier implicitName = context.getObjectNameNormalizer().normalizeIdentifierQuoting(
context.getBuildingOptions().getImplicitNamingStrategy().determineBasicColumnName(
@ -561,10 +567,9 @@ public abstract class AbstractPropertyHolder implements PropertyHolder {
true,
"",
"",
0
precision
);
}
}
private static Map<String, ColumnTransformer> buildColumnTransformerOverride(XAnnotatedElement element) {
Map<String, ColumnTransformer> columnOverride = new HashMap<>();