Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default value for int in OrmLite Android

I'm wondering how I can set the defualt value for an int in a DatabaseField in OrmLite for Android.

I have tried:

@DatabaseField(defaultValue = 0) 
int intValue;  

But all I get is a compilation error. Or can you even do this with int's?

like image 720
PaperThick Avatar asked Dec 05 '22 08:12

PaperThick


1 Answers

You can simply assign a value to your intValue in the class.

@DatabaseField() 
int intValue=10;

This makes intValue 10 by default, until you set it to something else.

like image 125
athor Avatar answered Jan 11 '23 13:01

athor