HHH-16551 - If discriminator column type is CHAR, set length to 1

This commit is contained in:
Cedomir Igaly 2023-05-04 19:00:38 +02:00 committed by Christian Beikov
parent 16a74b02e3
commit 8fceeaf542
1 changed files with 4 additions and 0 deletions

View File

@ -94,6 +94,10 @@ public class AnnotatedDiscriminatorColumn extends AnnotatedColumn {
case CHAR: case CHAR:
column.setDiscriminatorTypeName( "character" ); column.setDiscriminatorTypeName( "character" );
column.setImplicit( false ); column.setImplicit( false );
if ( discriminatorColumn != null && discriminatorColumn.length() != 1 && discriminatorColumn.length() != 31 ) {
throw new AssertionFailure( "Length for CHAR discriminator should always be 1" );
}
column.setLength( 1L );
break; break;
case INTEGER: case INTEGER:
column.setDiscriminatorTypeName( "integer" ); column.setDiscriminatorTypeName( "integer" );