MCPcopy Index your code
hub / github.com/greenrobot/greenDAO

github.com/greenrobot/greenDAO @V3.3.0 sqlite

repository ↗ · DeepWiki ↗ · release V3.3.0 ↗
2,378 symbols 8,629 edges 241 files 511 documented · 21%
README

Check out ObjectBox

Looking for object persistence faster than SQLite? Check out our new mobile database ObjectBox (GitHub).

greenDAO

greenDAO is a light & fast ORM for Android that maps objects to SQLite databases. Being highly optimized for Android, greenDAO offers great performance and consumes minimal memory.

Home page, documentation, and support links: https://greenrobot.org/greendao/

Build Status Follow greenrobot on Twitter

Features

greenDAO's unique set of features:

  • Rock solid: greenDAO has been around since 2011 and is used by countless famous apps
  • Super simple: concise and straight-forward API, in V3 with annotations
  • Small: The library is <150K and it's just plain Java jar (no CPU dependent native parts)
  • Fast: Probably the fastest ORM for Android, driven by intelligent code generation
  • Safe and expressive query API: QueryBuilder uses property constants to avoid typos
  • Powerful joins: query across entities and even chain joins for complex relations
  • Flexible property types: use custom classes or enums to represent data in your entity
  • Encryption: supports SQLCipher encrypted databases

Add greenDAO to your project

greenDAO is available on Maven Central. Please ensure that you are using the latest versions of the greendao and greendao-gradle-plugin artifact.

Add the following Gradle configuration to your Android project. In your root build.gradle file:

buildscript {
    repositories {
        jcenter()
        mavenCentral() // add repository
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0' // add plugin
    }
}

In your app modules app/build.gradle file:

apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao' // apply plugin

dependencies {
    implementation 'org.greenrobot:greendao:3.3.0' // add library
}

Note that this hooks up the greenDAO Gradle plugin to your build process. When you build your project, it generates classes like DaoMaster, DaoSession and DAOs.

Continue at the Getting Started page.

R8, ProGuard

If your project uses R8 or ProGuard add the following rules:

-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
public static java.lang.String TABLENAME;
}
-keep class **$Properties { *; }

# If you DO use SQLCipher:
-keep class org.greenrobot.greendao.database.SqlCipherEncryptedHelper { *; }

# If you do NOT use SQLCipher:
-dontwarn net.sqlcipher.database.**
# If you do NOT use RxJava:
-dontwarn rx.**

Homepage, Documentation, Links

For more details on greenDAO please check greenDAO's website. Here are some direct links you may find useful:

Features

Getting Started

Documentation

Changelog

Technical FAQ

Non-Technical FAQ

Migrating to greenDAO 3

More Open Source by greenrobot

ObjectBox is a new superfast object-oriented database for mobile.

EventBus is a central publish/subscribe bus for Android with optional delivery threads, priorities, and sticky events. A great tool to decouple components (e.g. Activities, Fragments, logic components) from each other.

Essentials is a set of utility classes and hash functions for Android & Java projects.

Extension points exported contracts — how you extend this code

PropertyConverter (Interface)
To use custom types in your entity, implement this to convert db values to entity values and back. Notes for implem [5 …
greendao-api/src/main/java/org/greenrobot/greendao/converter/PropertyConverter.java
Database (Interface)
Database abstraction used internally by greenDAO. [4 implementers]
DaoCore/src/main/java/org/greenrobot/greendao/database/Database.java
NoteClickListener (Interface)
(no doc) [2 implementers]
examples/DaoExample/src/main/java/org/greenrobot/greendao/example/NotesAdapter.java
NoteClickListener (Interface)
(no doc) [2 implementers]
examples/RxDaoExample/src/main/java/org/greenrobot/greendao/rxexample/NotesAdapter.java
TestInterface (Interface)
(no doc) [1 implementers]
tests/DaoTestBase/src/main/java/org/greenrobot/greendao/daotest/TestInterface.java
AsyncOperationListener (Interface)
Listener being called after completion of org.greenrobot.greendao.async.AsyncOperation. [3 implementers]
DaoCore/src/main/java/org/greenrobot/greendao/async/AsyncOperationListener.java
IdentityScope (Interface)
Common interface for a identity scopes needed internally by greenDAO. Identity scopes let greenDAO re-use Java objects. [2 …
DaoCore/src/main/java/org/greenrobot/greendao/identityscope/IdentityScope.java
DatabaseStatement (Interface)
(no doc) [4 implementers]
DaoCore/src/main/java/org/greenrobot/greendao/database/DatabaseStatement.java

Core symbols most depended-on inside this repo

get
called by 295
DaoCore/src/main/java/org/greenrobot/greendao/identityscope/IdentityScope.java
isNull
called by 184
DaoCore/src/main/java/org/greenrobot/greendao/Property.java
append
called by 146
DaoCore/src/main/java/org/greenrobot/greendao/query/QueryBuilder.java
size
called by 137
DaoCore/src/main/java/org/greenrobot/greendao/query/LazyList.java
bindLong
called by 127
DaoCore/src/main/java/org/greenrobot/greendao/database/DatabaseStatement.java
add
called by 115
DaoCore/src/main/java/org/greenrobot/greendao/query/LazyList.java
queryBuilder
called by 105
DaoCore/src/main/java/org/greenrobot/greendao/AbstractDao.java
getLong
called by 101
DaoCore/src/main/java/org/greenrobot/greendao/internal/FastCursor.java

Shape

Method 2,101
Class 261
Interface 11
Enum 5

Languages

Java100%

Modules by API surface

DaoGenerator/src/org/greenrobot/greendao/generator/Entity.java85 symbols
DaoGenerator/src/org/greenrobot/greendao/generator/Property.java67 symbols
DaoCore/src/main/java/org/greenrobot/greendao/AbstractDao.java63 symbols
DaoCore/src/main/java/org/greenrobot/greendao/internal/FastCursor.java42 symbols
DaoCore/src/main/java/org/greenrobot/greendao/query/LazyList.java41 symbols
DaoCore/src/main/java/org/greenrobot/greendao/query/QueryBuilder.java39 symbols
DaoCore/src/main/java/org/greenrobot/greendao/async/AsyncSession.java35 symbols
tests/DaoTest/src/androidTest/java/org/greenrobot/greendao/daotest/rx/RxDaoTest.java33 symbols
DaoCore/src/main/java/org/greenrobot/greendao/test/AbstractDaoTestSinglePk.java29 symbols
tests/DaoTestBase/src/main/java/org/greenrobot/greendao/daotest/RelationEntity.java26 symbols
tests/DaoTestBase/src/main/java/org/greenrobot/greendao/daotest/AbcdefEntity.java26 symbols
DaoGenerator/src/org/greenrobot/greendao/generator/Schema.java24 symbols

For agents

$ claude mcp add greenDAO \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact