mardi 2 février 2016

Sqlite - programmatically increase database

My question is at the same time easy and hard.

I try to explain the best I can:

I want to make possible to my entities to grow or to create new entities programmatically.

Example:

public class Foo{
    public UUID id;
    public String fooName;
}

I want to programmatically add some field to my entity, for example the previous entity should become similar to this:

public class Foo{
    public UUID id;
    public String fooName;
    public String addedField;
}

I know I can't edit my class's text but I can programmatically add some fields to my db. The problem is that even if the db has n fields, but the class has less fields, the adapter will not create a bigger class and the fields which are only in the db are lost.

I think I can do something like using only generics and reflection. And I'm pretty sure it will work, but is there a simpler way for achieve this point?

Thanks all





Aucun commentaire:

Enregistrer un commentaire