What is java equivilant for MySQL smallint

I have a column in a MySQL table named dead_heat_flag

whose datatype smallint

and I want to represent this column as one attribute in my Java class. What type of data should I use?

+3


source to share


3 answers


As per the comment below, for MySQL smallint , java short

must cover this range of values. You can of course also use int

, but keep in mind that it allows many values ​​that the database column does not have.



+3


source


A short value in java is equivalent to a small int since the range is the same. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive).



http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html for java https://docs.oracle.com/cd/E19501-01/819-3659/gcmaz/ for database

+1


source


I believe the datatype equivalent will be short

based on what I found here for java and here for a db that uses smallint . They both address the same range of values.

+1


source







All Articles