I have an tiny int column in MySQL. I want to convert it into int type of java.
So if I mention the column in my hibernate entity as
@Column(name="Columname")
private int something;
Will it cause an error as tiny int needs boolean type or will it get cast into int?
This code will be changed in production Db hence I cannot check it to see if it breaks.
JDBC driver maps databse type to java. So in case of mysql TINYINT will be converted to java.lang.Boolean or java.lang.Integer.
Refer this link which explains : Java, JDBC and MySQL Types
Go for the datatype Byte. it worked for me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With