sockeqwe / sqlbrite-dao

DAO for SQLBrite
http://hannesdorfmann.com/android/sqlbrite-dao
Apache License 2.0
182 stars 22 forks source link

when I query one table , must I select all of the columns ? #30

Closed sharyuke closed 8 years ago

sharyuke commented 8 years ago

when I query one table , must I select all of the columns ? If I select not all of the columns , it will says xxxx column does not exist.

sockeqwe commented 8 years ago

No, you don't have to query all columns, but you have to specify which columns are "optional"

@ObjectMapable
class MyModel {
   @Column("id")  // per default throwOnColumnIndexNotFound = true
    long id;

   @Column(value = "optionalName", throwOnColumnIndexNotFound = false)
    String optionalName;
}

Then an exception will be thrown if you try to query table without id column, but you can query table without optionalName

sharyuke commented 8 years ago

@sockeqwe thanks a lot.