make @Array apply to "implicit" columns

This commit is contained in:
Gavin 2023-05-10 15:15:42 +02:00 committed by Gavin King
parent 1d1053ef08
commit 36099deb2e
1 changed files with 8 additions and 3 deletions

View File

@ -745,9 +745,7 @@ public class AnnotatedColumn {
annotatedColumn.setLength( (long) column.length() ); annotatedColumn.setLength( (long) column.length() );
annotatedColumn.setPrecision( column.precision() ); annotatedColumn.setPrecision( column.precision() );
annotatedColumn.setScale( column.scale() ); annotatedColumn.setScale( column.scale() );
if ( inferredData.getProperty().isAnnotationPresent(Array.class) ) { annotatedColumn.handleArrayLength( inferredData );
annotatedColumn.setArrayLength( inferredData.getProperty().getAnnotation(Array.class).length() );
}
// annotatedColumn.setPropertyHolder( propertyHolder ); // annotatedColumn.setPropertyHolder( propertyHolder );
// annotatedColumn.setPropertyName( getRelativePath( propertyHolder, inferredData.getPropertyName() ) ); // annotatedColumn.setPropertyName( getRelativePath( propertyHolder, inferredData.getPropertyName() ) );
annotatedColumn.setNullable( column.nullable() ); //TODO force to not null if available? This is a (bad) user choice. annotatedColumn.setNullable( column.nullable() ); //TODO force to not null if available? This is a (bad) user choice.
@ -769,6 +767,12 @@ public class AnnotatedColumn {
return annotatedColumn; return annotatedColumn;
} }
private void handleArrayLength(PropertyData inferredData) {
if ( inferredData.getProperty().isAnnotationPresent(Array.class) ) {
setArrayLength( inferredData.getProperty().getAnnotation(Array.class).length() );
}
}
private static String logicalColumnName( private static String logicalColumnName(
PropertyData inferredData, PropertyData inferredData,
String suffixForDefaultColumnName, String suffixForDefaultColumnName,
@ -917,6 +921,7 @@ public class AnnotatedColumn {
column.applyGeneratedAs( inferredData, 1 ); column.applyGeneratedAs( inferredData, 1 );
column.applyCheckConstraint( inferredData, 1 ); column.applyCheckConstraint( inferredData, 1 );
column.extractDataFromPropertyData( propertyHolder, inferredData ); column.extractDataFromPropertyData( propertyHolder, inferredData );
column.handleArrayLength( inferredData );
column.bind(); column.bind();
return columns; return columns;
} }