vendredi 18 août 2017

Android - Couchbase lite - DAO - MyClass extends Document

I'm working on an Android application using Couchbase lite. Should I have my classes extending com.couchbase.lite.Document ?

Pros: DAO is integrated in class.

Cons: - every object is linked to a document, if we want a new object, we must create a new document in couchbase? - anything else?

For example:

public class UserProfile extends Document {

    public UserProfile (Database database, String documentId);

    public Map<String, Object> getProperties();

    public boolean isModified();

    public boolean update() throws CouchbaseLiteException {
        if (isModified()) {
            super.putProperties(getProperties());
            return true;
        }
        else
            return false;
    }
}

Aucun commentaire:

Enregistrer un commentaire