# daocompat **Repository Path**: mirrors_greenrobot/daocompat ## Basic Information - **Project Name**: daocompat - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DaoCompat: greenDAO on ObjectBox Using greenDAO? Keep the greenDAO API and use ObjectBox instead of SQLite for an extra boost. ObjectBox is a superfast object-oriented database with strong relation support. **DaoCompat = greenDAO - SQLite + ObjectBox** Using DaoCompat, you can easily switch to ObjectBox. Of course, this depends on your use of SQL/SQLite features because ObjectBox is a NoSQL database. Gradle setup ------------ You should start with the basic ObjectBox set up: check its [GitHub page](https://github.com/objectbox/objectbox-java) and [intro](http://objectbox.io/documentation/introduction/). Additionally, you need to enable the `objectbox.daoCompat` flag via annotation processor options, and add DaoCompat as a dependency. In the end, your app build.gradle should have those additions: apply plugin: 'io.objectbox' // after applying Android plugin android { defaultConfig { javaCompileOptions { annotationProcessorOptions { arguments = ['objectbox.daoCompat': 'true'] } } } } dependencies { compile "org.greenrobot:objectbox-daocompat:1.1.0" } First steps ----------- To create the greenDAO-like DaoSession, you need an instance of BoxStore from ObjectBox. You typically initialize those objects once for your app, e.g. in `onCreate` in your Application class: boxStore = MyObjectBox.builder().androidContext(this).build(); session = new DaoSession(boxStore); With the DaoSession you are already in your well-known greenDAO API territory. For example, you can get DAOs using `session.getMyEntityDao()` and then call methods like `insert(...)` or `load(...)`. Links ----- [ObjectBox DaoCompat Documentation](http://greenrobot.org/greendao/documentation/objectbox-compat/) [greenDAO](http://greenrobot.org/greendao) [ObjectBox](http://objectbox.io/) License ------- Copyright (C) 2011-2017 Markus Junginger, greenrobot (http://greenrobot.org). All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.