Fix “no such column” on Sugar ORM

I have this entity class to represent my sqlite table in my android apps.

public class TemporaryOrder extends SugarRecord<TemporaryOrder> {

    public String desc;
    public float lat;
    public float lng;
    public String note;
    public boolean isFrom;

    public TemporaryOrder() {

    public TemporaryOrder(String desc, float lat, float lng, String note, boolean isFrom) {
        this.desc = desc; = lat;
        this.lng = lng;
        this.isFrom = isFrom;
        this.note = note;

The problem appear when I need to check, whether there’s order with “isFrom” status true by doing this.

boolean isExists = Select.from(TemporaryOrder.class).where(Condition.prop("isFrom").eq(true)).count() > 1;
// I got this error : no such column: isFrom (code 1)

Evidently SugarORM turns camel case variable to underscore in sqlite, so we just need to replace “isFrom” to “is_From”.

boolean isExists = Select.from(TemporaryOrder.class).where(Condition.prop("is_From").eq(true)).count() > 1;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.