I’m using ORMlite to store the date in sqlite in android. I’ve created a POJO class for Data
and when i’m creating a member variable for the Time object or Date Object it is giving NullPointerException.
this is my Pojo class
@DatabaseTable(tableName="user_prior_commitment")
public class PreferencesPriorCommitmentRowData {
// id is generated by the database and set on the object automagically
@DatabaseField(generatedId = true)
int id;
@DatabaseField(index = true)
int user_id;
@DatabaseField
String description;
@DatabaseField
String location;
@DatabaseField
Date date;
@DatabaseField
String start_time;
@DatabaseField
String end_time;
@DatabaseField
int lattitude;
@DatabaseField
int longitude;
...
And manually i created the database with this table
and in my activity i use the below code
DatabaseManager<DatabaseHelper> manager = new DatabaseManager<DatabaseHelper>();
DatabaseHelper db = manager.getHelper(context);
Dao<PreferencesPriorCommitmentRowData, Integer> simpleDao =
db.getPreferencesPriordataDao();
List<PreferencesPriorCommitmentRowData>aa = simpleDao.queryForAll();
But before the last line it it giving Null Pointer Exception.
Kindly Help regarding this.
A
java.util.Datetype should map to a correspondingDATETIMEtype in the database. I think that should solve your problem.