Reputation: 121
I am using RushORM
database in my Android
App. I can save data but when I try to get the stored data it is throwing an exception:
Method threw
RushTableMissingEmptyConstructorException
.
Here is the model class that is table RushORM
database:
public class Linesmodel extends RushObject {
float startX, startY, stopX, stopY;
String cityName;
float joinX, joinY = 0;
Linesmodel(float startX, float startY, float stopX, float stopY) {
this.startX = startX;
this.startY = startY;
this.stopX = stopX;
this.stopY = stopY;
}
Linesmodel(String cityname, float startX, float startY, float stopX, float stopY) {
this.startX = startX;
this.startY = startY;
this.stopX = stopX;
this.stopY = stopY;
this.cityName = cityname;
}
Linesmodel(float startX, float startY) { // for convenience
this(startX, startY, startX, startY);
}
}
Here is the code by which I am saving data:
for (Linesmodel l : lines) {
new Linesmodel(selectedCity, l.startX, l.startY, l.stopX, l.stopY).save();
}
Here is the code that fetches the data. The exception is thrown on this code:
List<Linesmodel> linesList = new RushSearch().find(Linesmodel.class);
Upvotes: 0
Views: 62
Reputation: 1147
RushOrm uses reflection to populate the properties and therefore needs an empty constructor.
Just add this constructor and you should be good
Linesmodel() {}
Also on an unrelated note you might want to try saving your list using
RushCore.getInstance().save(objects)
Does the same just faster, although you will only really notice the differences at 100+ objects.
Upvotes: 0