4
new Select("id")
.From(customer)
.where("lastName=?","John")
.execute();

Error

 E/CursorWindow: Failed to read row 0, column -1 from a CursorWindow which has 1 rows, 1 columns.

Main query (select id from customer where lastName="John";)

PEHLAJ
  • 9,980
  • 9
  • 41
  • 53
  • Could you please be more specific on your issues? Add some code maybe then we will able to help you the best as we can – Jackyto Mar 22 '17 at 08:42
  • Show the code where the exception actually happens (i.e., where you try to read from the cursor). – CL. Mar 22 '17 at 08:56
  • `Failed to read row 0, column -1` means no such column exist in your query result. – Paresh P. Mar 22 '17 at 09:21

1 Answers1

0

Try

List<Customer> results = new Select().from(Customer.class).where("lastName=?","John").execute();

if(results.size() > 0) {
    long id = results.get(0).getId(); 
}
PEHLAJ
  • 9,980
  • 9
  • 41
  • 53