fix storing food to the database
This commit is contained in:
parent
9663dd499e
commit
b6f3fae487
1 changed files with 6 additions and 5 deletions
|
@ -70,7 +70,7 @@ public class FoodHelper {
|
|||
public boolean createOrUpdate(Food food) {
|
||||
try {
|
||||
// find by NS _id
|
||||
if (food._id != null) {
|
||||
if (food._id != null && !food._id.equals("")) {
|
||||
Food old;
|
||||
|
||||
QueryBuilder<Food, Long> queryBuilder = getDaoFood().queryBuilder();
|
||||
|
@ -90,12 +90,13 @@ public class FoodHelper {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
getDaoFood().createOrUpdate(food);
|
||||
log.debug("FOOD: New record: " + food.toString());
|
||||
scheduleFoodChange();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
getDaoFood().createOrUpdate(food);
|
||||
log.debug("FOOD: New record: " + food.toString());
|
||||
scheduleFoodChange();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue