I am new to ormlite and i want to set default value for some fields like
@DatabaseField(generatedId = true, canBeNull = false)
int id;
@DatabaseField(canBeNull = true)
String user_type;
@DatabaseField(canBeNull = true)
String username;
@DatabaseField(canBeNull = true)
String password;
@DatabaseField(canBeNull = true)
int id_color;
I have to set the default value for the username field. How do I do this? Thanks in advance!!!!
I’ve spent a lot of time on the ORMLite documentation. You should always start there. If you go to the documentation index, and look up default value it would show you that there is a
defaultValuefield in@DatabaseFieldannotation. Here are the javadocs for that field.Something like the following should work: