AutoIncrement primary key in subclass of Room model

By | July 12, 2018
Questions:

I have a class Model

public abstract class Model {
    @PrimaryKey
    @NonNull
    public String id;
}

and sub-class FooModel

@Entity
public FooModel extends Model {
    String name;
}

I’d like to mark id as autoincrement but only in the child FooModel using @PrimaryKey(autoGenerate = true)

How can I go about this?

Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *