I use ORMLite and now have got a question that I can not answer. Look at my example : I have class implementes Serializable.
class Time implements Serializable {
private long time;
...blabla
}
and class Operation that includes Time
class Operation implements Serializable {
private Time time;
...blabla
}
Operation is a database table but Time not. As I think Time stored in database as byte array because it is Serializable Object. The question is it right to use ORMLite query like eq(), between() and other like that :
OperationDao.queryBuilder().where().between("time_field", timeObject1, timeObject2);
I am interested in : How does it work? Can I do queries like this and how? Or it is impossible, because Time is byte array and can not be used for query?
Thanks for good answers.
The short answer is no, you can't query for fields that are stored in the database as
Serializable
. I would recommend instead to use a JodaDateTime
which gets stored in the database as along
. You will need to specify the@DatabaseField(dataType = DATE_TIME)
because ORMLite works withDateTime
using reflection. See the DateTimeType.