Java 如何在android的object box数据库中插入对象列表?喜欢房间数据库

Java 如何在android的object box数据库中插入对象列表?喜欢房间数据库,java,android,android-room,objectbox,Java,Android,Android Room,Objectbox,我想在对象框中插入对象列表。这样做可能吗?就像android中的房间数据库一样。有人知道怎么做吗?还是不可能? 示例代码如下所示: notesBox = ((App) getApplication()).getBoxStore().boxFor(Note.class); ArrayList<Note> noteList = new ArrayList<>(); notesBox.put(noteList); notesBox=((App)getApplication()

我想在对象框中插入对象列表。这样做可能吗?就像android中的房间数据库一样。有人知道怎么做吗?还是不可能?

示例代码如下所示:

notesBox = ((App) getApplication()).getBoxStore().boxFor(Note.class);
ArrayList<Note> noteList = new ArrayList<>();
notesBox.put(noteList);
notesBox=((App)getApplication()).getBoxStore().boxFor(Note.class);
ArrayList noteList=新建ArrayList();
notesBox.put(票据列表);

是的,这完全符合您的建议。它也比逐个放置更有效(列表中的所有对象都将放在单个事务中)