objectbox-examples icon indicating copy to clipboard operation
objectbox-examples copied to clipboard

ObjectBox DaoCompat

Open wangwei66666 opened this issue 2 years ago • 1 comments

I want to migrate your existing greenDAO data to ObjectBox.

// note example
List<com.example.app.daos.greendao.Note> notes = daoSession.getNoteDao().loadAll();
List<Note> convertedNotes = convertToObjectBoxNotes(notes);
daoCompatSession.getNoteDao().insertInTx(convertedNotes);

GreenDao is promoted to ObjectBox, I don’t know how to convert ‘converttoObjectBoxnotes’. Can you provide a specific instance?

wangwei66666 avatar Aug 31 '22 13:08 wangwei66666

Hi, sorry for seeing this so late (we typically track issues at https://github.com/objectbox/objectbox-java).

Did you figure this out? Basically you need to map your DAO object to an ObjectBox object. It's up to your code on how to do this.

In that case you also might want to use the ObjectBox Store and Box APIs directly instead of going through the DAOcompat APIs.

greenrobot-team avatar Oct 10 '22 05:10 greenrobot-team