@@ -55,6 +55,8 @@ public class DefaultSizeTest extends ORMTestCase {
5555 final static String tableNameCharArray = "just_char_arraies" ;
5656 final static String columnNameCharArray = "char_array" ;
5757
58+ final static String tableNameDatatype = "datatypes" ;
59+
5860 @ Test
5961 public void testStringUsesDefaultSizeChar () throws ORMConfigurationException , SQLException {
6062 setUpWithDefaultSize (JustString .class , 1 );
@@ -121,6 +123,30 @@ public void testCharArrayUsesDefaultSizeLongText() throws ORMConfigurationExcept
121123 }
122124 }
123125
126+ @ Test
127+ public void testOtherDataTypesDoNotUseDefaultSize () throws ORMConfigurationException , SQLException {
128+ // smallint defaults to the size 6 the default size should therefore not be chosen as 6 or higher;
129+ setUpWithDefaultSize (Datatype .class , 5 );
130+
131+ // smallint defaults to 6
132+ (new Field (tableNameDatatype , "primitive_short" )).assertType ("smallint(6)" );
133+ (new Field (tableNameDatatype , "wrapper_short" )).assertType ("smallint(6)" );
134+
135+ // tinyint defaults to 11
136+ (new Field (tableNameDatatype , "primitive_integer" )).assertType ("int(11)" );
137+ (new Field (tableNameDatatype , "wrapper_integer" )).assertType ("int(11)" );
138+
139+ // bigint defaults to 20
140+ (new Field (tableNameDatatype , "primitive_long" )).assertType ("bigint(20)" );
141+ (new Field (tableNameDatatype , "wrapper_long" )).assertType ("bigint(20)" );
142+
143+ (new Field (tableNameDatatype , "primitive_float" )).assertType ("float" );
144+ (new Field (tableNameDatatype , "wrapper_float" )).assertType ("float" );
145+
146+ (new Field (tableNameDatatype , "primitive_double" )).assertType ("double" );
147+ (new Field (tableNameDatatype , "wrapper_double" )).assertType ("double" );
148+ }
149+
124150 private void setUpWithDefaultSize (Class <? extends Model > clazz , int defaultSize ) throws ORMConfigurationException {
125151 ORMConfig config = new ORMConfig ()
126152 .setDefaultSize (defaultSize );
0 commit comments