Open pmrajani opened 7 years ago
It's true, the column "job_id" doesn't exist as "jobid" anymore.. it should be "jobId" any field you name with `````` should be specified as camelCased e.g Example: if this is my class
class User extends SugarRecord{
public String user_id;
public String user_name;
public String firstName;
public User(){
}
}
My query will be as follows:
List<User> users = Select.from(User.class)
.where(Condition.prop("userName").eq("kigen"))
.and(Condition.prop("first_name").eq("kigen"))
.list()
It's some kind of weird logic.. when a field name is camelCased the Condition.prop()
value will be separated with _
eg camel_cased
and vice versa.
Try changing to:
mJobs = Select.from(UserJob.class) .where(Condition.prop("jobId").eq(job.job_id)) .list();
Let us know if it works.
SQLiteException: no such column: job_id (code 1): , while compiling: SELECT * FROM USER_JOB WHERE (job_id = ? )
` import android.os.Parcel; import android.os.Parcelable;
import com.orm.SugarRecord;
/**
public class UserJob extends SugarRecord implements Parcelable {
}`
Insert Data from Activity code is bellow
`for(int i=0;i<jobs.resource.size();i++){ UserJob mJob = new UserJob(jobs.resource.get(i).id, jobs.resource.get(i).user_id, jobs.resource.get(i).job_id, jobs.resource.get(i).status,jobs.resource.get(i).created_at,jobs.resource.get(i).starred); mJob.save(); }
Log is showing size = 2 this is right and it's comes from tables record Now I want where query on my Fragment but it's show no such column: job_id
FRAGMENT CLASS
mJobs = Select.from(UserJob.class) .where(Condition.prop("job_id").eq(job.job_id)) .list();
Here App is crash and show error.