Fix issue with Column size detection causing errors during schema generation

This commit is contained in:
Andrea Boriero 2020-04-28 15:43:33 +01:00
parent 4e6011d093
commit 72bf70f013
1 changed files with 11 additions and 12 deletions

View File

@ -242,22 +242,21 @@ public class Column implements Selectable, Serializable, Cloneable {
if ( sqlType == null ) { if ( sqlType == null ) {
Size size = new Size( getPrecision(), getScale(), getLength(), null ); Size size = new Size( getPrecision(), getScale(), getLength(), null );
Type type = getValue().getType(); Type type = getValue().getType();
if ( size.getLength() == null if ( size.getLength() == null && size.getScale() == null && size.getPrecision() == null ) {
&& size.getScale() == null && size.getPrecision() == null ) {
if ( type instanceof EntityType ) { if ( type instanceof EntityType ) {
while ( !( type instanceof JdbcMapping ) ) {
//ManyToOneType doesn't implement JdbcMapping //ManyToOneType doesn't implement JdbcMapping
type = mapping.getIdentifierType( ( (EntityType) type ).getAssociatedEntityName() ); type = mapping.getIdentifierType( ( (EntityType) type ).getAssociatedEntityName() );
if ( type instanceof ComponentType ) { if ( type instanceof ComponentType ) {
type = ( (ComponentType) type ).getSubtypes()[getTypeIndex()]; type = ( (ComponentType) type ).getSubtypes()[getTypeIndex()];
} }
} }
if ( type instanceof JdbcMapping ) { }
size = dialect.getDefaultSizeStrategy().resolveDefaultSize( size = dialect.getDefaultSizeStrategy().resolveDefaultSize(
( (JdbcMapping) type ).getSqlTypeDescriptor(), ( (JdbcMapping) type ).getSqlTypeDescriptor(),
( (JdbcMapping) type ).getJavaTypeDescriptor() ( (JdbcMapping) type ).getJavaTypeDescriptor()
); );
} }
}
try { try {
sqlType = dialect.getTypeName( getSqlTypeCode( mapping ), size ); sqlType = dialect.getTypeName( getSqlTypeCode( mapping ), size );