SiimKinks / sqlitemagic

Compile time processed, annotation driven, no reflection SQLite database layer for Android
https://siimkinks.github.io/sqlitemagic/javadoc/
Apache License 2.0
121 stars 11 forks source link

UpdateBuilder does not work when passing value directly #14

Closed vincent-paing closed 5 years ago

vincent-paing commented 5 years ago

Here's the reproducible code

@Table(persistAll = true)
public class Entity {

  @Id(autoIncrement = true) public Long id;

  public Boolean isSomething;
}

And updating isSomething column with following code

 Update.table(EntityTable.ENTITY)
        .set(EntityTable.ENTITY.IS_SOMETHING, true)
        .execute();

This should translate to

UPDATE TABLE entity SET isSomething = true

However, the code does not compile because it cannot resolve method, since it does not know the method where you pass the value instead of Column..etc.

image

Tested on version 0.23.1

SiimKinks commented 5 years ago

The updatable column public Boolean isSomething is nullable (since there is missing @NonNull/@NotNull annotation). To keep things very explicit and clear SqliteMagic is trying to make API consumers aware of nullability. Therefore there is a method setNullable which will work in your case.