greenDAO README

The project's README from github.com/greenrobot/greenDAO. As one markdown file: README.md.

⚠️ This project is not longer actively maintained. If you are looking for an easy to use and efficient database solution, please:

Check out ObjectBox

Check out our new mobile database ObjectBox (GitHub repo).

ObjectBox is a superfast object-oriented database with strong relation support. ObjectBox is embedded into your Android, Linux, macOS, or Windows app.

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:

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:<agp-version>'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.3.1' // 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.**

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.

greenDAO (greenrobot/greenDAO)

Searching Database…

12.6K ·GitHub
这是什么?greenDAO 是一个轻量级 ORM,可以把 Java 对象映射到 Android 上的 SQLite 数据库,并在构建时生成 DAO 类,因此无需手写 SQL。
它是独立应用,还是需要我添加到 Android 项目里的东西?它由一个库和一个 Gradle 插件组成:你需要把 greendao 和 greendao-gradle-plugin 构件添加到 Android 项目中,构建时它会生成 DaoMaster、DaoSession 以及各个 DAO 类。
我该如何把它添加到项目中?greenDAO 可以从 Maven Central 获取:在根目录的 build.gradle 和应用模块的 build.gradle 中添加 greendao 和 greendao-gradle-plugin 依赖,然后构建项目以生成 DAO 类。
除了标准的 Android/Gradle 工具之外,还需要其他东西吗?只需要一个标准的 Gradle Android 项目;无需原生依赖,因为该库是纯 Java 实现(它也支持可选的 SQLCipher 加密)。
这个项目还在积极维护吗?不再积极维护。greenrobot 团队现在推荐 ObjectBox 作为仍在维护的替代方案。
我的数据库可以加密吗?可以,greenDAO 支持 SQLCipher 加密的 SQLite 数据库,适用于需要加密的应用。
greenDAO 的查询 API 与原始 SQL 字符串有什么不同?它的 QueryBuilder 使用属性常量,而不是原始的列名字符串,因此查询是类型安全的,也能避免拼写错误。
greenDAO 能处理实体之间的复杂关系吗?可以,它支持跨实体的强大连接查询,包括为复杂关系串联多个 JOIN。
它需要特殊的 ProGuard/R8 规则吗?需要。如果项目使用 R8 或 ProGuard,就需要为 greenDAO 添加特定的 keep 规则,这些规则记录在 README 中。
Creator
greenrobot
Size
7.2 MB
Stars
12.6K
Age
14y
Commits · 90 Days