0

I have my app's networking code separated into a separate package. This package contains a POJO model that I'm serializing with Gson (using its @Expose annotation):

public class User {
    @Expose
    String username;

    @Expose
    String pathToAvatar;

    // etc.
}

My app also is using ActiveAndroid as a database wrapper. I would like to extend the .networking.User model and add a couple more database-specific fields (secretKey or something) in my main logic. It would be nice if the networking code did not know its model was being used in a database. Unfortunately, I'm having to have .networking.User extend the ActiveAndroid Model base class (and having to label each networking variable with @Column). This works, with one problem: I'm getting a dummy User database table that corresponds with the networking code's class, even though it is not annotated with @Table, simply because it derives from Model. The main code's table is created correctly.

Can I prevent ActiveAndroid from creating a table when it finds a certain Model? Alternatively, is there a better way to approach this?

George Hilliard
  • 15,402
  • 9
  • 58
  • 96

0 Answers0