Quote table and columns for update()
I think you should quote table and columns for update():
Error while trying to update a table named Order:
near "Order": syntax error (code 1): , while compiling: UPDATE OR ABORT Order SET LocationId=?,DateUpdate=?,Date=?,StatusId=?,OrderId=?,EventId=?,DateInsert=? WHERE OrderId=1
Which update() method you're using? One of them does not quote its columns because of the ContentProvider. Can't remember which one.
BaseModel.update()
Trying to save(through setter/constructor) a foreign key which is model causes following problem , in:
model$adapter > bindToStatement (sqlstatment,model) >
................................................................................
// Begin Saving Foreign Key References From Model
if (model.transaction != null) {
model.transaction.save();
Calling save() generates :
near "Transaction": syntax error (code 1): , while compiling: UPDATE OR ABORT Transaction SET companyID=?,timestamp=?,amount=?,categoryID=?,description=?,type=?,id=? WHERE id=2
Any way to avoid this ?
You can use the new Update<>(), like:
new Update<>(Order.class).set(
Condition.column(Order$Table.LOCATION_LOCATIONID).is(order.getLocationId()),
Condition.column(Order$Table.EVENT_EVENTID).is(order.getEventId()),
Condition.column(Order$Table.STATUS_STATUSID).is(order.getStatusId()),
.where(Condition.column(Order$Table.ORDERID).is(order.getId()))
.query();
That's exactly what i am doing, thanks for the suggestion.However using queries like this makes you unable to use the FlowContentObserver .
Im going to see if I can solve this during the rewrite of the annotation processor in 3.0.0 and find a safe way to do this.
fixed it.