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 10 forks source link

Error on using with AutoValue and auto increment Id #11

Closed vincent-paing closed 6 years ago

vincent-paing commented 6 years ago

Current my entity model has the following fields, with

@Table(value = "address") @AutoValue @AutoGson public abstract class AddressNew {

    @Id public abstract long _id();

    public abstract String address1();

    //create function here

    @AutoValue.Builder public abstract static class Builder {

        public abstract Builder _id(long _id);

        public abstract Builder address1(String address1);
    }
}

In the generated Dao, it would call the builder constructor that doesn't exist. particularly here

public final class SqliteMagic_AddressNew_Dao {
  public static AddressNew setId(AddressNew entity, long id) {
    return new AutoValue_AddressNew.Builder(entity)._id(id).build();
  }
//...
}
SiimKinks commented 6 years ago

Looks like in AutoValue 1.4 they removed this constructor.

As a "quick workaround" you can use AutoValue 1.3. This issue will be addressed in the next release.

SiimKinks commented 6 years ago

Fixed in https://github.com/SiimKinks/sqlitemagic/commit/316940fb3cc6c356f2ef673f97ed894a786e17e7