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