I want to set default value of integer value in my table using hibernate annotations.It works but when i give default value as 1 it always set it to zero in the database.I don't know what i am doing wrong.Any help will be appreciated
This is what i am using
@Column(name = "interval",nullable = false, columnDefinition = “int default 1")
private int interval;
I have checked almost all the links i dont know when i am setting the value to be 1 then why 0 is getting stored in the database
I know we can do it as
@Column(name = "interval",nullable = false, columnDefinition = “int default 1")
private int interval = 1;
but i dont want to set the value as above I want to know to any way to set the default value using hibernate
I had already seen these links How to set default value in Hibernate Set default values using hibernate annotations in MYSQL