A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

Related tags

O/R Mapping DBFlow
Overview

README

Image

JitPack.io Android Weekly Android Arsenal

DBFlow is fast, efficient, and feature-rich Kotlin database library built on SQLite for Android. DBFlow utilizes annotation processing to generate SQLite boilerplate for you and provides a powerful SQLite query language that makes using SQLite a joy.

DBFlow is built from a collection of some of the best features of many database libraries. Don't let an ORM or library get in your way, let the code you write in your applications be the best as possible.

DBFlow Contains:

Kotlin: Built using the language, the library is super-concise, null-safe and efficient.

Annotation Processor: Generates the necessary code that you don't need to write.

Core: Contains the main annotations and misc classes that are shared across all of DBFlow.

DBFlow: The main library artifact used in conjunction with the previous two artifacts.

Coroutines: Adds coroutine support for queries.

RX Java: Enable applications to be reactive by listening to DB changes and ensuring your subscribers are up-to-date.

Paging: Android architecture component paging library support for queries via QueryDataSource.

LiveData: Android architecture LiveData support for queries on table changes.

SQLCipher: Easy database encryption support in this library.

SQLite Query Language: Enabling autocompletion on sqlite queries combined with Kotlin language features means SQLite-like syntax.

Changelog

Changes exist in the releases tab.

Usage Docs

For more detailed usage, check out it out here

Including in your project

Add jitpack.io to your project's repositories:

allProjects {
  repositories {
    google() 
    // required to find the project's artifacts
    // place last
    maven { url "https://www.jitpack.io" }
  }
}

Add artifacts to your project:

  apply plugin: 'kotlin-kapt' // only required for kotlin consumers.

  def dbflow_version = "5.0.0-alpha2"
  // or 10-digit short-hash of a specific commit. (Useful for bugs fixed in develop, but not in a release yet)

  dependencies {

    // Use if Kotlin user.
    kapt "com.github.agrosner.dbflow:processor:${dbflow_version}"

    // Annotation Processor
    // if only using Java, use this. If using Kotlin do NOT use this.
    annotationProcessor "com.github.agrosner.dbflow:processor:${dbflow_version}"


    // core set of libraries
    implementation "com.github.agrosner.dbflow:core:${dbflow_version}"
    implementation "com.github.agrosner.dbflow:lib:${dbflow_version}"

    // sql-cipher database encryption (optional)
    implementation "com.github.agrosner.dbflow:sqlcipher:${dbflow_version}"
    implementation "net.zetetic:android-database-sqlcipher:${sqlcipher_version}@aar"

    // RXJava 2 support
    implementation "com.github.agrosner.dbflow:reactive-streams:${dbflow_version}"

    // Kotlin Coroutines
    implementation "com.github.agrosner.dbflow:coroutines:${dbflow_version}"

    // Android Architecture Components Paging Library Support
    implementation "com.github.agrosner.dbflow:paging:${dbflow_version}"

    // Android Architecture Components LiveData Library Support
    implementation "com.github.agrosner.dbflow:livedata:${dbflow_version}"

    // adds generated content provider annotations + support.
    implementation "com.github.agrosner.dbflow:contentprovider:${dbflow_version}"

  }

Pull Requests

I welcome and encourage all pull requests. Here are some basic rules to follow to ensure timely addition of your request: 1. Match coding style (braces, spacing, etc.) This is best achieved using Reformat Code shortcut, command+option+L on Mac and Ctrl+Alt+L on Windows, with Android Studio defaults. 2. If its a feature, bugfix, or anything please only change code to what you specify. 3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :) 4. Pull requests must be made against develop branch. Any other branch (unless specified by the maintainers) will get rejected. 5. Have fun!

Maintainer

Originally created by Raizlabs, a Rightpoint company

Maintained by agrosner (@agrosner)

Comments
  • Add support for RxJava

    Add support for RxJava

    Hi there!

    DBFlow looks like a promising library! I will definitely give it a shot with one of my next projects. One thing I immediately found when looking into the querying wiki pages was the lacking support for RxJava and observables. As this is an emerging (and booming) pattern in Android development I would really love to see support for this!

    Anybody interested too?

    opened by davidschreiber 36
  • [3.0.0-beta1]Table is not registered with a Database. Did you forget the @Table annotation?

    [3.0.0-beta1]Table is not registered with a Database. Did you forget the @Table annotation?

    But I have the folowing structure:

    @Database(name = WeatherDB.NAME, version = WeatherDB.VERSION)
    public class WeatherDB {
    
        public static final String NAME = "Weather";
    
        public static final int VERSION = 1;
    }
    

    And table:

    @Table(database = WeatherDB.class)
    public class WeatherTable extends BaseModel {
    
        @Column
        @PrimaryKey
        private long dateStamp;
        @Column
        private double dayTemperature;
        @Column
        private double minTemperature;
        @Column
        private double maxTemperature;
        @Column
        private double nightTemperature;
        @Column
        private double eveTemperature;
        @Column
        private double mornTemperature;
        @Column
        private int humidity;
        @Column
        private String description;
        @Column
        private double windSpeed;
    
       //getters and setters
    }
    

    Full stacktrace:

    Process: me.bitfrom.weatherapp, PID: 3939
                                                                         com.raizlabs.android.dbflow.structure.InvalidDBConfiguration: Table: me.bitfrom.weatherapp.database.WeatherTable is not registered with a Database. Did you forget the @Table annotation?
                                                                             at com.raizlabs.android.dbflow.config.FlowManager.getDatabaseForTable(FlowManager.java:109)
                                                                             at com.raizlabs.android.dbflow.config.FlowManager.getModelAdapter(FlowManager.java:271)
                                                                             at com.raizlabs.android.dbflow.config.FlowManager.getTableName(FlowManager.java:68)
                                                                             at com.raizlabs.android.dbflow.sql.language.From.<init>(From.java:55)
                                                                             at com.raizlabs.android.dbflow.sql.language.Select.from(Select.java:58)
                                                                             at me.bitfrom.weatherapp.ui.fragments.TodaysWeatherFragment.onViewCreated(TodaysWeatherFragment.java:31)
                                                                             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:908)
                                                                             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
                                                                             at android.app.BackStackRecord.run(BackStackRecord.java:834)
                                                                             at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
                                                                             at android.app.FragmentManagerImpl$1.run(FragmentManager.java:447)
                                                                             at android.os.Handler.handleCallback(Handler.java:739)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                             at android.os.Looper.loop(Looper.java:211)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5389)
                                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                                             at java.lang.reflect.Method.invoke(Method.java:372)
                                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
    
    opened by KChernenko 35
  • Using DBFlow in more than one module

    Using DBFlow in more than one module

    When I try to use DBFlow in more than one module I get an error. I figured out it was because it creates two DataBaseHolder classes in the same package. Is there a way to avoid this and use only one class for the whole project?

    enhancement 
    opened by strigare 32
  • Example of Inserting relationship with the Queen and Ant

    Example of Inserting relationship with the Queen and Ant

    I am having difficulty finding documentation relating to the creation and inserting of records.

    Queen q = new Queen();
    q.name = "Best Queen";
    q.save();
    
    Ant a = new Ant();
    a.type = "worker";
    a.isMale = false;
    a.associateQueen(q);
    a.save();
    

    Returns an error: Cannot call save() on a foreign key container. Call load() instead

    What is the correct way of inserting records with relationships?

    opened by surfer190 31
  • Table is not registered with a Database. Did you forget the @Table annotation?

    Table is not registered with a Database. Did you forget the @Table annotation?

    Hello.

    I'm trying to use DBFlow version 3.0.0-beta5 in a project that uses

    • Dagger 2.2
    • DBFlow v3.0.0-beta5
    • Glide v3.7.0
    • Retrofit v2.0.0
    • Couple other small libraries for small utility stuff like AndroidViewAnimations.

    I often times get the following exception:

    com.raizlabs.android.dbflow.structure.InvalidDBConfiguration: Table: com.levibostian.app.UserModel is not registered with a Database. Did you forget the @Table annotation?
    

    This is not consistent, but happens very often, cleaning and rebuilding the app usually doesn't help (but sometimes does).

    I have checked out this issue which talks about disabling instant run, which I have done with same result of it happening most of the time, but not every single time.

    I have also checked out this issue which talks about using gradle clean from command line instead of in Android Studio. I have been doing ./gradlew clean and reinstalling my app every build (even if I do not edit any of the DBFlow touching code in my project) and no change of behavior either.

    Like I mentioned before, I am receiving this regularly but not every time. Maybe 75% of the time? The stacktrace triggers on this line of code:

    mFlowCursorList = new FlowCursorList<UserModel>(false, SQLite.select().from(UserModel.class).where(UserModel_Table.responded.isNull()).orderBy(UserModel_Table.user_id, true));
    

    in my adapter class which may be the first part of interaction with my Model classes. When the app does run the 25% of the time, it runs great with no issues.

    Any help, please and thank you.

    opened by levibostian 29
  • ForeignKey | Define column name of referenced class

    ForeignKey | Define column name of referenced class

    Setup:

    • DBFlow Version: 4.0.0-beta1
    • Target Platform: Android 23
    • Gradle/Maven: Gradle v2.10 Android Gradle Plugin v2.0.0
    • Build Tools: 24.0.3
    • Kotlin: 1.0.3 with kapt

    Issue Kind: Question

    Description:

    I want to reference a Model from another Model (See below). The problem with the version below is, I get

    Cannot find symbol method getFrom()
    Cannot find symbol method getTo()
    Cannot find symbol method getFrom()
    Cannot find symbol method getTo()
    
    @Table(database = MMHDatabase::class)
    class Transaction(from: Account? = null, value: Float = 0.0f, to: Account? = null, id: Long = -1) : BaseModel() {
        companion object {
            fun get(id: Long) : Transaction? {
                return (select
                        from Transaction::class
                        where (Transaction_Table.id eq id)).result
            }
        }
    
        @PrimaryKey(autoincrement = true)
        var id: Long = -1
    
        @ForeignKey
        var from: Account? = null
    
        @Column
        var value: Float = 0.0f
    
        @ForeignKey
        var to: Account? = null
    }
    

    Corresponding generated code (Line 3 and 9):

     1public final void bindToInsertValues(ContentValues values, Transaction model) {
     2    if (model.getFrom() != null) {
     3      values.put("from_id", model.getFrom().getFrom());
     4    } else {
     5      values.putNull("from_id");
     6    }
     7    values.put("value", model.getValue());
     8    if (model.getTo() != null) {
     9      values.put("to_id", model.getTo().getTo());
    10    } else {
    11      values.putNull("to_id");
    12    }
    13  }
    

    and (Line 3 and 9)

     1 public final void bindToInsertStatement(DatabaseStatement statement, Transaction model, int start) {
     2    if (model.getFrom() != null) {
     3      statement.bindLong(1 + start, model.getFrom().getFrom());
     4    } else {
     5      statement.bindNull(1 + start);
     6    }
     7    statement.bindDouble(2 + start, model.getValue());
     8    if (model.getTo() != null) {
     9      statement.bindLong(3 + start, model.getTo().getTo());
    10    } else {
    11      statement.bindNull(3 + start);
    12    }
    13  }
    

    I expected it would use the get method of the primary key of the Account class which would be getId().

    bug 
    opened by paraqles 27
  • Many to many

    Many to many

    Hi, Is there any support for many to many relations ? If not, How would you implement it ?

    I thought about something like that: With doctors having many patients and patients having many doctors, all through an appointment

    Doctor.java

        @Table
        public class Doctor extends BaseModel {
    
            @Column(columnType = Column.PRIMARY_KEY)
            public  int               id;
            public  List<Appointment> appointments;
            private List<Patient>     patients;
    
            public Doctor() {
                super();
            }
    
            public List<Appointment> getAppointments() {
                if (appointments == null) {
                    appointments = Select.all(Appointment.class, Condition.column(Appointment$Table.DOCTORID).is(id));
                }
                return appointments;
            }
    
            public List<Patient> getPatients() {
                if (patients == null) {
                    // patients = { Select.all Patient INNER JOIN Appointments ON Patient.id = patientId }
                }
                return patients;
            }
        }
    

    Patient.java

        @Table
        public class Patient extends BaseModel {
    
            @Column(columnType = Column.PRIMARY_KEY)
            public  int               id;
            public  List<Appointment> appointments;
            private List<Doctor>      doctors;
    
            public Patient() {
                super();
            }
    
            public List<Appointment> getAppointments() {
                if (appointments == null) {
                    appointments = Select.all(Appointment.class, Condition.column(Appointment$Table.PATIENTID).is(id));
                }
                return appointments;
            }
    
            public List<Doctor> getDoctor() {
                if (doctors == null) {
                    // patients = { Select.all Patient INNER JOIN Appointments ON Patient.id = patientId }
                }
                return doctors;
            }
        }
    

    Appointment.java

        @Table
        public class Appointment extends BaseModel {
    
            @Column(columnType = Column.PRIMARY_KEY_AUTO_INCREMENT)
            public int id;
            public int doctorId;
            public int patientId;
    
            @Column(columnType = Column.FOREIGN_KEY,
                    references = { @ForeignKeyReference(columnType = Appointment.class,
                            columnName = "appointment", foreignColumnName = "id") })
            public Patient patient;
            @Column(columnType = Column.FOREIGN_KEY,
                    references = { @ForeignKeyReference(columnType = Appointment.class,
                            columnName = "appointment", foreignColumnName = "id") })
            public Doctor  doctor;
    
            public Appointment() {
                super();
            }
    
            public Doctor getDoctor() {
                return doctor;
            }
    
            public Patient getPatient() {
                return patient;
            }
    
        }
    
    opened by damson 25
  • Multi Database Modules works on 3.0.1 but not on 3.1.1

    Multi Database Modules works on 3.0.1 but not on 3.1.1

    DBFlow Version: 3.1.1 Bug: Multi module no longer works

    Description: when using version 3.0.1 multi module works fine but when updated to version 3.1.1 i get this error and it can't find the generated database holder class (it exists in android studio i can open it but can't build the project)

    Warning:File for type 'com.raizlabs.android.dbflow.config.FordDatabaseFord_Database' created in the last round will not be subject to annotation processing.
    Warning:File for type 'com.raizlabs.android.dbflow.config.FordModuleGeneratedDatabaseHolder' created in the last round will not be subject to annotation processing.
    Warning:The following options were not recognized by any processor: '[targetModuleName]'
    
    opened by ec84b4 23
  • Update DB failed - duplicate column

    Update DB failed - duplicate column

    I want to migrate my App Databse from version 2 to version 3. While the database is in version 2 I added a new Model "Test". Then I added a new Column in version 3 and used the migrations addColumn().

    If I update the installed App with database version 2 to 3 everything is working. But if I update an installed App with database version 1 to 3 the mirgation failed with:

    Upgrading Database from 1 to 3 I/Database﹕ Executing Migration: x.x.x.database.migrations: AddTestColumn E/SQLiteLog﹕ (1) duplicate column name: test2

    This means, that the Model-Table is created with all its columns and then it tries to run the migrations with addColumn().

    Isn't adding a Model be versioned as well?

    enhancement question 
    opened by Informaticore 21
  • Transaction out to date! Migration 3.0.0-beta5 to 3.1.1

    Transaction out to date! Migration 3.0.0-beta5 to 3.1.1

    DBFlow Version: Question

    Hello. I am doing a migration process and I would like to know what is the new version of this:

    TransactionManager.transact(PaidUpDatabase.DATABASE_NAME, business::update);

    This valid until 3.0.0-beta5 which is by the way not avaible on the repositorie. So My question now is how can I achieve the new version of transact?

    Thanks in advanced for your help.

    opened by AugustoAleGon 20
  • Cannot find symbol class ...GeneratedDatabaseHolder

    Cannot find symbol class ...GeneratedDatabaseHolder

    DBFlow Version: 3.0.0-beta6 Issue Kind (Bug, Question, Feature): Question

    Please note if you are using Instant Run, there may be bugs where generated classes are not created. Ensure you are using the apt or kapt plugins and that incremental compilation is off.

    Description: Hi, Error:(14, 42) error: cannot find symbol class SkyfishGeneratedDatabaseHolder Skyfish is my module. It occurred after updated to 3.0.0-beta6. Previously, i used 3.0.0-beta1 and no problem. Please help.

    opened by elsennov 18
  • @OneToMany definition getXXXModels Cannot find setter

    @OneToMany definition getXXXModels Cannot find setter

    ISSUE_TEMPLATE

    DBFlow Version: 5.0.0-alpha2

    Bug or Feature Request: Bug

    Description: @get:OneToMany(oneToManyMethods = [OneToManyMethod.LOAD]) val schemeDataModels: List? by oneToMany { select from SchemeDataModel::class where SchemeDataModel_Table.schemeModel_id.eq(id) }

    error: class com.dbflow5.processor.definition.OneToManyDefinition : @OneToMany definition getSchemeDataModels Cannot find setter setSchemeDataModels for variable schemeDataModels.

    ` @Table(database = AppDatabase::class) data class SchemeModel( @PrimaryKey(autoincrement = true) var id: Long = 0, @Column var schemeName: String = "",

    ) : BaseModel() {
    
    @get:OneToMany(oneToManyMethods = [OneToManyMethod.LOAD])
    val schemeDataModels: List<SchemeDataModel>? by oneToMany {
        select from SchemeDataModel::class where SchemeDataModel_Table.schemeModel_id.eq(id)
    }
    

    } `

    @Table(database = AppDatabase::class) data class SchemeDataModel( @PrimaryKey(autoincrement = true) var id: Long = 0, @ForeignKey(stubbedRelationship = true) var schemeModel: SchemeModel? = null, @Column var mimeType: String = "", @Column var data1: String = "", @Column var data2: String = "" ) : BaseModel()

    opened by mofreeLife 0
  • Could not find com.github.Raizlabs.DBFlow:dbflow:3.0.1

    Could not find com.github.Raizlabs.DBFlow:dbflow:3.0.1

    ISSUE_TEMPLATE

    DBFlow Version:3.0.1

    Bug or Feature Request:

    Description: When compiling an old project, we can't download our current library. We can download it when we upgrade to 4.0.2, but we get an error when compiling, the version difference is large and the amount of modification is also large, because the time is tight and it is too late to upgrade, can you help?

    Could not find com.github.Raizlabs.DBFlow:dbflow-core:3.0.1 Could not find com.github.Raizlabs.DBFlow:dbflow:3.0.1.

    https://www.jitpack.io/com/github/Raizlabs/DBFlow/dbflow-core/3.0.1/dbflow-core-3.0.1.pom https://www.jitpack.io/com/github/Raizlabs/DBFlow/dbflow-core/3.0.1/dbflow-core-3.0.1.jar https://www.jitpack.io/com/github/Raizlabs/DBFlow/dbflow/3.0.1/dbflow-3.0.1.pom https://www.jitpack.io/com/github/Raizlabs/DBFlow/dbflow/3.0.1/dbflow-3.0.1.jar

    opened by future-lj 0
  • Transaction for entities proceeded by RXJava observer with DBFlow

    Transaction for entities proceeded by RXJava observer with DBFlow

    DBFlow Version: 5.0.0-alpha1

    Bug or Feature Request: Question

    Description:

    How to use DBFlow transaction for RXJava observer so that the transaction is for whole stream of items proceeded by the observer? My attempt is:

    new Observer<Item>() {
              @Override
              public void onSubscribe(@NonNull Disposable d) {
                FlowManager.getDatabase(AppDatabase.class).beginTransaction();
              }
    
              @Override
              public void onNext(@NonNull Item item) {
                FlowManager.getModelAdapter(Item.class).save(item, FlowManager.getDatabase(AppDatabase.class));
              }
    
              @Override
              public void onError(@NonNull Throwable error) {
              }
    
              @Override
              public void onComplete() {
                FlowManager.getDatabase(AppDatabase.class).endTransaction();
              }
            };
    

    But beginTransaction() blocks processing of items.

    opened by quillalady 0
  • Attempt to invoke virtual method '....RetrievalAdapter.getModelClass()' on a null object reference

    Attempt to invoke virtual method '....RetrievalAdapter.getModelClass()' on a null object reference

    DBFlow Version: 4.2.4

    Bug or Feature Request: Attempt to invoke virtual method '....RetrievalAdapter.getModelClass()' on a null object reference

    Description: I'm getting the exception occasionally in production. Not sure why this fails only occasionally. Anyone have an idea?

    Fatal Exception: java.lang.NullPointerException
    Attempt to invoke virtual method 'java.lang.Class com.raizlabs.android.dbflow.structure.RetrievalAdapter.getModelClass()' on a null object reference
    
    com.raizlabs.android.dbflow.sql.saveable.ModelSaver.getWritableDatabase (ModelSaver.java:169)
    com.raizlabs.android.dbflow.sql.saveable.ModelSaver.save (ModelSaver.java:29)
    com.raizlabs.android.dbflow.structure.ModelAdapter.save (ModelAdapter.java:186)
    com.raizlabs.android.dbflow.structure.BaseModel.save (BaseModel.java:62)
    
    opened by jchristof 0
  • Cast Example

    Cast Example

    ISSUE_TEMPLATE

    DBFlow Version: 3.1.1

    Bug or Feature Request:

    Description: I have a fairly complex query I'm trying to port to DBFlow semantics. The biggest hurdle I've had is trying to figure out the syntax for a query piece that looks essentially like this:

    SELECT Message.X, Message.Y, Message.Z, CASE WHEN CAST(Conversation.Bookmark AS LONG) <= 0 THEN false ELSE true END isBookmarkAvailable

    I can get part way there with the syntax IProperty foo = Method.cast(Conversation_Table.Bookmark).as(SQLiteType.INTEGER); but I cannot do a comparison "<= 0" on the IProperty.

    opened by apsoftware-andyp 0
Releases(5.0.0-alpha2)
  • 5.0.0-alpha2(Mar 13, 2021)

    Many updates!

    1. NEW livedata artifact (consider it experimental). Call .toLiveData on your wrapper queries when included in the project.
    2. Docs have been revamped, lots of fixes and improvements. Removed all java examples in favor of Kotlin usage
    3. Gradle files now use kotlin
    4. Respect order of Primary Key definition in insert statement
    5. Optimize more code generation
    6. RX support is bumped to RX3
    7. Breaking: Index wrapper enable and disable have been replaced with their SQL accurate counterparts createIfNotExists and drop.
    8. New: DBFLow configure DSL
    FlowManager.init(context) { 
      // this is FlowConfig.Builder
      database<AppDatabase> {
        // this is DatabaseConfig.Builder
        table<MyTable> {
          // this is TableConfig.Builder
        }
      }
      // other module dbs
      databaseHolder<MyGeneratedDatabaseHolder>()
    }
    
    1. SQL: adds random orderby method
    2. Migrations: support default values in ALTER table statement
    3. Migrations: Restore pre 5.0.0-alpha1 migration order where they run after table creation in upgrade of DB.
    4. Foreign Key Constraints: fix issue where foreign key constraint support not always enabled or done properly. Now we perform it in onConfigure of the DB.
    5. NEW: FTS4 and FTS3 support.
    6. Breaking: Require DatabaseWrapper in any db operation, removing model extension methods that are parameterless in most places. to grab DB, use database<MyDatabase> { db -> or val db = database<MyDatabase>()
    7. Breaking: Breaking change: String "?" no longer are unescaped and treated as blank INSERT value args. Use Property.WILDCARD instead.
    8. Model queries that do not run in a transaction now will log as warnings to encourage you to place them in transactions.
    9. NEW: TableObserver provides a way to observe table changes in an efficient way for observable queries.
    10. NEW: match operator for queries
    11. NEW: tables can be represented without actually being created in the DB. use createWithDatabase in the @Table or @ModelView annotations.
    12. Breaking: IMultiKeyCacheConverter -> MultiKeyCacheConverter
    13. NEW: create TEMP tables support using @Table(temporary = true)
    14. Breaking: async queries from RX asFlowable or others, instead of passing DatabaseWrapper and ModelQueriable like:
    .asFlowable { d, modelQueriable -> modelQueriable.queryList(d) }
    

    Now its the receiver parameter of the function:

    .asFlowable { db -> queryList(db) }
    
    1. OneToMany: fix issue where cache and one to many would not work when using the all operators.
    2. FlowQueryList/FlowCursorList: allow passing own Handler to be used rather than the thread its created on.
    3. Breaking: its an error to have multiple converters on the same model type. Error message describes how to fix.
    • allow overwriting built-ins without error
    • better error messaging in general with less noise
    1. BaseProviderModel: fix potential leaking cursor when no results found.
    2. SQLCipher: Latest version is now 4.4.2, Write ahead logging support!
    3. Breaking: prepackaged dbs now can run migrations to get to current version when db version is 0 but we set our db version to something higher. This reduces errors by allowing you to keep an older version of DB as prepackaged but will run through migrations to get to current app version's DB.

    Also many bug fixes! https://github.com/agrosner/DBFlow/milestone/51?closed=1

    Source code(tar.gz)
    Source code(zip)
  • 5.0.0-alpha1(Oct 21, 2018)

    1. Rename package name for project to com.dbflow5. Some significant package reorganization that makes much more sense going forward.
    2. Project is back under my account! To include, please replace uses of "com.github.raizlabs.dbflow:" to "com.github.agrosner.dbflow:" in project dependencies.
    3. Added new paging, coroutines, contentprovider (splits out use into separate module). Expect a livedata module in next couple releases. Removed RXJava 1 support.
    4. Library is now 100% KOTLIN! (except generated java code, which can't quite yet be Kotlin). All kotlin-extensions modules have rolled into their java counterpart as a single Kotlin unit.
    5. Simplifications in API for Transactions to eliminate redundancies. Also, now Transaction require a type parameter R which is return value. They now return a value, and have a completion() callback. All interfaces have rolled into Kotlin Typealias to methods.
    6. All sqlite query language infix (LINQ-style) methods rolled into the query language!
    7. Attempted to keep java compatibility and nice API. If anything is missing, please file a bug.
    8. save() now use a insert or replace statement rather than a load of the model from the db and then inserting / saving based on that, resulting in significant performance increase.
    9. no more ContentValues used at all in any CRUD operations under the hood, and by default these don't get generated: bindToInsertValues, bindToContentValues. if you need them, set @Table(generateContentValues = true).
    10. Breaking Change: By default @Table(allFields = true), meaning you dont have to explicitly mark each property as part of DB. Previously you had to use @Column everywhere.
    Source code(tar.gz)
    Source code(zip)
  • 4.2.4(Dec 28, 2017)

    1. dropTrigger from SqlUtils takes in a DatabaseWrapper.
    2. Fix broken annotation processor code output tests. #1437
    3. Fix issues where DatabaseStatement in library in wrapper statements were not closed properly. #1497
    4. Fix issue where single reference (non table object) used wrong name for property in the primary condition clause, causing compile issue. #1504
    Source code(tar.gz)
    Source code(zip)
  • 4.2.3(Dec 20, 2017)

    1. update Issue template
    2. fix pom file generation on jitpack #1487
    3. fix issue where save(DatabaseWrapper) would leave open insert or update statment. #1496
    4. Allow (but still warn) about autoincrementing ids being null. if null, they are treated as if they are 0 meaning that they will get inserted rather than updated in the DB during a save operation. #1490
    5. Update warning on wrong type passed in operator class for value #1488
    Source code(tar.gz)
    Source code(zip)
  • 4.2.2(Dec 18, 2017)

    Fix critical issue where TypeConverter always appear as SQLiteType.TEXT in the DB even if its type did not match up.

    Adds a test to ensure it stays true.

    https://github.com/Raizlabs/DBFlow/issues/1481

    Source code(tar.gz)
    Source code(zip)
  • 4.2.1(Dec 17, 2017)

  • 4.2.0(Dec 17, 2017)

    Support for Android O Content Providers. Simply add this line to your AndroidManifest.xml:

    <provider
                android:name="com.raizlabs.android.dbflow.runtime.StubContentProvider"
                android:authorities="com.dbflow.authority"/>
    

    Which will allow normal content observing to continue. It is highly recommended to supply your own authority: use your own package name. so for com.grosner.example app I would add:

    <provider
                android:name="com.raizlabs.android.dbflow.runtime.StubContentProvider"
                android:authorities="com.grosner.example"/>
    
    FlowManager.init(FlowConfig.Builder(context)
                .addDatabaseConfig(DatabaseConfig.Builder(MyDatabase.class)
                    .modelNotifier(new ContentResolverNotifier("com.grosner.example"))
                    .build()).build());
    
    Source code(tar.gz)
    Source code(zip)
  • 4.1.2(Oct 21, 2017)

    1. Autoincrement model saver does not call saveForeignKeys() #1454
    2. Ability to reopen DB without deleting #1449
    3. AutoIncrementModelSaver causes IllegalArgumentException since it uses wrong insert statement #1447
    4. Disallow nullable autoincrementing fields. (kotlin nullable (?) and @Nullable annotations)
    5. Can close all DBs at runtime. #1418
    6. fix support for byte[], class was incorrectly treated as invalid array type. #1463
    7. Compiled with Kotlin 1.1.51, 26.0.2 of Android build-tools, and 3.0.0-rc2 of Android Gradle plugin.
    Source code(tar.gz)
    Source code(zip)
  • 4.1.1(Aug 31, 2017)

  • 4.1.0(Aug 27, 2017)

    1. @ModelView are now created after migrations are run so latest DB data is respected.
    2. New annotation @ColumnMap! It enables embedding other object's exposed properties into the current table as @Column so that object hierarchy is respected without excessive DB complication.
    class Location(var latitude: Double = 0.0, var longitude: Double = 0.0)
    
    @Table(database = TestDatabase::class)
    class Position(@PrimaryKey var id: Int = 0, @ColumnMap var location: Location? = null)
    

    creates a table with the following columns:

      public static final Property<Integer> id = new Property<Integer>(Position.class, "id");
      public static final Property<Double> latitude = new Property<Double>(Position.class, "latitude");
      public static final Property<Double> longitude = new Property<Double>(Position.class, "longitude");
    
    1. @Database(name = , extension = ) are deprecated. Specify the name now in the DatabaseConfig.databaseName() when FlowManager is initialized. This means that DBFlow supports dynamic database names and instances.
    FlowManager.init(FlowConfig.builder()
        .addDatabaseConfig(DatabaseConfig.builder(AppDatabase.class)
          .databaseName("AppDatabase")
          .databaseExtension(".txt")
          .build())
        .build())
    

    To dynamically swap database out, replace the FlowConfig:

    FlowManager.getDatabase(AppDatabase.class)
      .reset(DatabaseConfig.builder(AppDatabase.class)
        .databaseName("AppDatabase-2")
        .build())
    

    Note that this will overwrite all existing database properties for a database. Any TableConfig properties missing will get ignored. Also it will delete existing db and reopen with new instance specified.

    1. @Database(inMemory = ) is deprecated. Use the new builder method:
    
    FlowManager.init(FlowConfig.builder()
        .addDatabaseConfig(DatabaseConfig.inMemoryBuilder(AppDatabase.class)
          .databaseName("AppDatabase")
          .build())
        .build())
    
    1. Support javax.annotation.Generated if it's on the classpath.
    2. @Database(generatedClassSeparator = ) is now deprecated. It will be standardized to the default _ in a future breaking release.
    3. @OneToMany now auto-detect visibility of the reference field so isVariablePrivate() is deprecated.
    4. Can specify @ForeignKeyReference(notNull = @NotNull()) annotation for individual references. Required to specify all references on a @ForeignKey if you need to specify for one.
    5. Some better error messaging in the annotation processor so its easier to find solutions to common issues.
    6. Rename count() (deprecated) to longValue() so its more clear exactly what is happening.
    7. fix #1401 which enables custom TypeConverters to carry into an as() alias of a Property.
    8. Add new TransactionWrapper which allows grouping of ITransaction into one to get executed at same point in db time.
    9. Lib now compiles with SDK 26 with latest build tools including api/implementation of 3.0.0+ gradle plugin.
    10. RXJava2 is now updated to 2.1.3
    11. Update some methods of dbflow-kotlin-extensions to accept nullable values for objects where it makes sense. See commit
    12. Automatic creation of tables can be turned off on a table-by-table basis with createWithDatabase(). Useful for preserving scrapped table in previous migrations.
    13. Using Kotlin we can drastically reduce the @OneToMany code implementation:
    
        @OneToMany(methods = {OneToMany.Method.ALL}, variableName = "ants")
        public List<Ant> getMyAnts() {
            if (ants == null || ants.isEmpty()) {
                ants = SQLite.select()
                    .from(Ant.class)
                    .where(Ant_Table.queen_id.eq(id))
                    .queryList();
            }
            return ants;
        }
    

    to:

    @get:OneToMany(methods = arrayOf(OneToMany.Method.ALL))
    var ants by oneToMany { select from Ant::class where (Ant_Table.queen_id.eq(id)) }
    
    Source code(tar.gz)
    Source code(zip)
  • 4.0.5(Jul 17, 2017)

    1. Move the GeneratedDatabaseHolder off the last round, warnings should be gone!
    2. Update Kotlin to 1.1.3-2
    3. update Gradle plugin to 2.3.3 (3.0.0-beta currently breaks robolectric unit testing)
    4. Some new extensions
    5. add Property.allProperty(MyTable.class) so you can easily specify MyTable.* in a query.
    6. Some optimizations on generated code including removing some redundant null checking.
    7. Fix issue where DatabaseStatement in update were not closed when used in a ModelAdapter.saveAll() method.
    8. Fix package private ModelView that duplicated field definitions in generated _ViewTable class.
    9. RXJava2: Change Single to Maybe for nullable returns.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.4(Jun 9, 2017)

    1. Even better Kotlin support. if a field is not null in Kotlin or using the android.support.annotation.NonNull/org.jetbrains.annotations.NotNull annotation, we will not attempt to assign a null value on it when the Cursor contains a null value. Primitives always did this of course, but now its expanded to any time.
    2. Fixed a bug by throwing a compiler error if you reference another class in another package that has package private fields, yet its not annotated with @Table, @ModelView, or @QueryModel. You must make it public or getter/setter private.
    3. Fix nullable Float fields not compiling.
    4. Add BigIntegerConverter to the lib!
    5. Fix issue where primary keys of a reference@PrimaryKey has the same name as the calling table, i.e. both having id as a column name in the generated ModelAdapter code.
    6. Fix issue where generated @ManyToMany referenced tables that had primary keys with TypeConverter not properly calling typeconverter, leading to compile errors.
    7. Fix issue where a table with cachingEnabled=true with a stubbedRelationship table where the object that calls load called the same instance from the cache (effectively not doing anything), and did not reload its fields from the DB.
    8. More bug fixes + improvements.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.3(Jun 2, 2017)

    1. Fix issue with notIn with BaseModelQueriable parameters
    2. Enhanced Kotlin support by annotation almost all of public api with @Nullable and @NonNull
    3. Fix bug with @ManyToMany generated class not properly handling type converters.
    4. A couple more bug fixes.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.2(May 16, 2017)

    1. Fix issue where enums broke the processor. #enumsmatter
    2. Replace ContentValues with DatabaseStatement for updating models, this results in a 33%-50% speed increase!
    3. More @NonNull and @Nullable annotations
    4. Delete queries also use generated DatabaseStatement, speeding up bulk deletes.
    5. Add notnull to @InteritedColumn annotations.
    6. RXJava observeOnTableChanges() updates. each ModelNotifier has common interface for interaction.
    7. ModelChangeListener for DirectModelNotifier now uses OnTableChangeListener.onTableChanged() which adds a Class for which table changed. This enables better consolidation of interfaces. OnTableChangedListener promoted to top-level interface.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.1(May 12, 2017)

  • 4.0.0(May 11, 2017)

    Major new release. Some of the major changes:

    1. Code generation significantly reduced. more than ~40% reduction in lines of code. Also order is deterministic and always the same in output.
    2. Condition -> Operator including ConditionGroup -> OperatorGroup
    3. Rewrote a lot of annotation processor with KPoet and now 99% Kotlin!
    4. Much better Kotlin support via @NonNull and @Nullable annotations on most public api methods.
    5. Can supply a different way to notify observers of changes via the new DirectModelNotifier or legacy ContentResolverNotifier
    6. Remove Model restriction from the library. Classes no longer need to implement Model. Kotlin consumers can take advantage of extension methods in kotlin-extensions to make classes act like Model.
    7. Latest plugins + Kotlin 1.1.2
    8. PrimaryKey can have type converters.
    9. ForeignKeyContainer is replaced with @ForeignKey(stubbedRelationship = true). Use Model.load() to get same functionality as before, without the confusion! 10 . Removed ModelContainer implementation and support. Since removing support, the annotation processor is cleaner and easier to maintain.
    10. Added RXJava1 + 2 support via sub-packages, with corresponding Kotlin extension libraries.
    11. New documentation website here
    12. Bug fixes, documentation updates, and more.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0-beta7(Apr 12, 2017)

  • 4.0.0-beta6(Apr 7, 2017)

    This should be last beta before 4.0.0 if no serious issues.

    1. rewrite unit tests - most classes are tested. more tests will follow
    2. Condition are now Operator, this includes SQLCondition -> SQLOperator, ConditionGroup -> OperatorGroup. Operator are now typed and safer to use. -> Operator now also have div, times, rem, plus and minus methods.
    3. Property class changes: -> All primitive Property classes have been removed. We already boxed the values internally anyways so removing them cut down on method count and maintenance. -> BaseProperty no longer needs to exist, so all of it's methods now exist in Property -> mod method is now rem (remainder) method to match Kotlin 1.1's changes. -> dividedBy is now div to match Kotlin operators. -> multipliedBy is now times to match Kotlin operators.
    4. Add KPoet to Annotation processor to make processing code more readable.
    5. Many More Kotlin extension methods
    6. Code output is deterministic, meaning always in same order unless generated files are added or removed.
    7. Reduce code generation further in this branch.
    8. Add a bunch of @Nullable and @NonNull annotations to public api members to better support Kotlin.
    9. Abstracted out the default Model notification system to allow you to override how its done. the options include ContentResolverNotifier (default, previous implementation wrapped in new), or DirectModelNotifier - receive changes with the Model directly.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0-beta5(Jan 5, 2017)

  • 4.0.0-beta4(Jan 2, 2017)

    1. Close insert SQLiteStatement from ModelAdapter when resetting DB.
    2. @QueryModel + @ModelView no longer require their BaseQueryModel + BaseModelView base classes.
    3. Added ability to specify allowedSubTypes in TypeConverter, meaning subclasses of types can all register to same typeconverter.
    4. Allow user override of default TypeConverters by declaring usual custom converter with the @TypeConverter annotation.
    5. Cut libs method count footprint by ~100. Library now stands at 2278 methods. Also cut down on generated code + generated code method references when some method overrides were generated even when not actually used for custom behavior in ModelAdapter.
    6. Methods Added: Add nullIf() and ifNull() methods. Support strftime(), date(), and datetime() methods.
    7. Can now disable caching for models with caching enabled in certain queries via:
    select().from(MyTable.class)
    .disableCaching()
    .queryList()
    
    1. save, delete, + update methods in Model + ModelAdapter all return boolean for success / failure.
    2. Can specify custom db extension via @Database(databaseExtension = ) 10 .ProcessModel interface method now adds a DatabaseWrapper: processModel(Model, DatabaseWrapper
    3. Can do async insert, update, and delete via:
    insert(MyTable.class)
    .columns(...)
    .values(...)
    .async()
    .execute()
    
    1. Minor bug fixes + code stability improvements.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0-beta3(Dec 12, 2016)

    1. Rewrote most tests in full Kotlin
    2. Some bug fixes
    3. Update to 1.5.0-2 of Kotlin
    4. Update to compile with API 25 + 2.2.3 of Gradle plugin
    5. Simplified ForeignKeyReference annotation when specifying it in the @ForeignKey. Removed : columnType(), referencedFieldIsPrivate(), referencedFieldIsPackagePrivate(), referencedGetterName(), and referencedSetterName() since we already were grabbing the referenced definition in the processor. This will eliminate need for those fields and should make simple headaches go away!
    6. If DB gets closed, we reopen it next time we use it in the lib.
    7. Add Selection args to StringQuery
    8. Fixed an issue where multiple modules may have been broken.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0-beta2(Nov 13, 2016)

    1. Upgrade to API 25 (7.1.1)
    2. @Column with TypeConverter now properly convert specified Model types in SQLite queries via the generated TypeConvertedProperty class! Also you can reverse the query to specify the Database-typed query in a SQLite query:
    Coordinate coord = ...;
    SQLite.select().from(MyTable.class).
      .where(MyTable_Table.coordinate.eq(coord))
      .querySingle();
    

    or

    Latitude lat = ...;
    SQLite.select().from(MyTable.class).
      .where(MyTable_Table.coordinate.invertProperty().eq("40.707720, -74.014842"))
      .querySingle();
    
    1. Add BigDecimalConverter as default converted included in lib.
    2. Fix issue with private field access in a @ForeignKey reference, due to new processor code.
    3. More bug fixes.
    4. Remove type param from BaseModelView, no longer necessary or needed.
    5. Fixes issue where Enum were not properly converted.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0-beta1(Oct 17, 2016)

    In 4.0, DBFlow has greatly improved its internals and flexibility in this release. We have removed the Model restriction, rewritten the annotation processor completely in Kotlin, and more awesome improvements.

    Major Changes In this release

    1. PrimaryKey can have TypeConverters, be table-based objects, and all kinds of objects. No real restrictions.
    2. ForeignKey have been revamped to allow stubbedRelationship. This replaces ForeignKeyContainer.
    3. Model interface now includes load() to enabled reloading very easily when fields change.
    4. All ModelContainer implementation + support has been removed. A few reasons pushed the removal, including implementation. Since removing support, the annotation processor is cleaner, easier to maintain, and more streamlined. Also the support for it was not up to par, and by removing it, we can focus on improving the quality of the other features.
    5. The annotation processor has been rewritten in Kotlin! By doing so, we reduced the code by ~13%.
    6. Removed the Model restriction on tables. If you leave out extending BaseModel, you must interact with the ModelAdapter.
    7. We generate ~45% less code than 3.0. Combined the _Table + _Adapter into the singular _Table class, which contains both Property + all of the regular ModelAdapter methods. To ease the transition to 4.0, it is named _Table but extends ModelAdapter. So most use cases / interactions will not break.
    Source code(tar.gz)
    Source code(zip)
  • 3.1.1(Jul 4, 2016)

    Fix issue where project did not build on jitpack.io due to javadoc issues.

    Transaction Handler only initialized when used, not when class first accessed to prevent unnecessary Handler thread from starting. Also Transaction now have a newBuilder() method to allow easy copying of existing Transaction.

    Source code(tar.gz)
    Source code(zip)
  • 3.1.0(Jul 2, 2016)

    1. Bug fixes
    2. Fixes an issue where prepackaged databases were not copied over on initialization of DB. #867. Affects all versions post-3.0.0-beta6.
    3. New builder syntax for FlowQueryList + FlowCursorList. Deprecated a lot of their old methods. Also created a FlowCursorIterator so that iteration in FlowCursorList + FlowQueryList becomes way more efficient. Instead of loading the full list when iterating, it iterates and converts objects as you need them:
    for (TestModel model : cursorList) {
    
    }
    
    1. Can add primaryKeyConflict to @Table to optionally specify a conflict for a Primary key that gets appended to the creation query.
    2. NEW Kotlin SQLite LINQ-Style Syntax and improvements to the Kotlin Support. In dbflow-kotlinextensions you can now write queries in Kotlin as:
    var results = (select
                          from Result::class
                          where (column eq 6)
                          and (column2 `in`("5", "6", "9"))
                          groupBy column).list
                  // can call .result for single result
                  // .hasData if it has results
                  // .statement for a compiled statement
    

    Some new syntactic sugar that makes queries even more functional:

    model.async save {
      // completed, now do something with model
    }
    

    Retrievals:

    (select
        from Result::class
        where (column eq 6))
     .async result { transaction, model ->
        // do something here
        updateUI(model)
    }
    

    for Lists:

    // easy async list query
    (select
        from Result::class
        where (column eq 6))
    .async list { transaction, list ->
        // do something here
        updateUI(list)
    }
    
    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(May 29, 2016)

    1. Fixes issue where AsyncModel operations did not actually operate on its associated Model.
    2. Fix code gen for overridden Update, Insert, delete ops where passing in DatabaseWrapper did not honor @OneToMany annotation.
    3. Fix issue where ListModelSaver ignores caching rules.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(May 28, 2016)

    This release incorporates a host and slew of improvements. A large chunk of the library has been rewritten, reworked, and improved significantly.
    New Features

    1. Properties: Instead of generated column String names, Property simplify queries even further and provide type-safety.
    2. Transactions Rewritten: Transactions have been rewritten from the ground-up to provide flexibility, better syntax, and easy customization. You can even swap out the library's system and replace it with your own.
    3. Database Encryption Support: via SQLCipher enables secure databases with minimal configuration and effort in DBFlow!
    4. Usage Docs: I rewrote usage docs to be more comprehensive and informative.
    5. Foreign Keys Simplified: no longer do you have to manually specify @ForeignKey references.
    6. Caching with Multiple Primary Keys: Caching now supports multiple primary keys and keys of any supported type.
    7. Database Modules: DBFlow is supported in multiple application projects via modules. This enables sharing of Databases and their associated files.
    8. Better Code Generation: Support package private fields from different packages, better error messaging during compile phase, significant code gen improvements, and more.
    9. Kotlin Extensions Support: Via dbflow-kotlinextensions allows you to write better DBFlow code in Kotlin.
    10. New SQLite features supported such as Case, CAST, and more!
    11. Many bug fixes, code comment improvements, code generation improvements, and more.

    To read on the basic migration steps, read here

    Source code(tar.gz)
    Source code(zip)
  • 3.0.0-beta6(Apr 25, 2016)

    Ideally this will be the final beta before 3.0 goes live. The next release should incorporate any more bugs or issues found in 3.0, so keep reporting!

    This release contains three significant updates:

    1. Initialization of DBFlow has changed. Now configuration of ModelAdapter, @Database, and other classes can mostly be done through the new FlowConfig.Builder class. For a simple example, view an example here
    2. The transactions system got a complete and utter overhaul. Welcome the Transaction.Builder! Each Transaction contains Success and Error callbacks for easy listening. See the migration guide for guidance. By default, we no longer use a priority-based queue for transactions. To keep that, read here. You can now also specify and roll your own ITransactionQueue or BaseTransactionManager, read up here.
    3. I rewrote the documentation completely for accuracy and for better organization. I hope you like!

    Some new features:

    1. Can now use the CASE Operator! `SQLite.
    SQLite.select(CaseModel_Table.customerId,
                    CaseModel_Table.firstName,
                    CaseModel_Table.lastName,
                    SQLite.caseWhen(CaseModel_Table.country.eq("USA"))
                            .then("Domestic")
                            ._else("Foreign").end("CustomerGroup")).from(CaseModel.class);
    
    1. Can Collate.LOCALIZED and Collate.UNICODE
    2. Can now multipliedBy(), add(), dividedBy(), mod(), and concatenate() IProperty together.
    3. This release contains a number of bug fixes as well here](https://github.com/Raizlabs/DBFlow/issues?q=milestone%3A3.0.0-beta6+is%3Aclosed)
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0-beta5(Mar 7, 2016)

    1. Fixes a critical issue where some queries (those that end off at Where) count()/hasData() when run with empty table throws a SQLiteDoneException on the query. now suppresses exception and logs it.
    2. can now pass in DatabaseWrapper into any saving methods of a ModelAdapter in order to better work in migrations! So that we do not recursively call the SQLiteDatabaseObject. So now all CRUD operations are supported in DBFlow migrations:
    
    ModelAdapter modelAdapter = FlowManager.getModelAdapter(SomeTable.class);
    
    modelAdapter.save(wrapper, someModel);
    
    
    modelAdapter.insert(wrapper, someModel); 
    
    
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0-beta4(Mar 3, 2016)

    This release contains a few major updates.

    1. All unit tests are now run in JVM via Robolectric
    2. @ForeignKey now saveForeignKeyModel=false by default, since this can lead to errors or unexplained performance hits. Rather be safe to be explicit!
    3. @ManyToMany can now specify the name of the generated join table. Also they can point to themselves (i.e. User_User). Also can configure saveForeignKeyModels() for each generated @ForeignKey.
    4. @ContentProvider generated now call down directly to the corresponding database methods. This is to simplify and prevent most other issues from coming up.
    5. Now there's an incubating dbflow-kotlinextensions! It provides some Kotlin language features such as items.processInTransactionAsync { it.save() } or 5.property.eq(SomeTable_Table.num)
    6. Migration no longer require empty constructor, but also support, since this led to hard-to-find compile time errors for some people:
        public TestMigration(Class<TestModel1> table) {
            super(table);
        }
    
    1. Versions of 3.0.0-beta1 - 3.0.0-beta3 incorrectly created tables that specified autoincrement=true. What happened is that it treated them like a ROWID. This is fixed in this version, and to fix it for any existing table, you must include and subclass the included migration snippet here. It will run a one-time migration check if you had used this in earlier versions of the 3.0 lib. If it doesn't affect you or seem to notice, a new rowID param has been added to the @PrimaryKey annotation that will keep the existing way (to prevent inconsistencies).
    2. all wrapper queries now have access to hasData() which returns count() > 0.
    3. All saving, updating, deleting, and inserting is now done via a configurable ModelSaver class. All corresponding SqlUtils static methods have been deprecated. To specify your own subclass for any extra behavior:
    FlowManager.getModelAdapter(SomeTable.class).setModelSaver(new MySubclassModelSaver());
    
    // this might need to get configured for the corresponding `ModelContainerAdapter` if you use `@ModelContainer`.
    FlowManager.getContainerAdapter(SomeTable.class).setModelSaver(new MyModelContainerSubclassModelSaver());
    
    1. Fix issues with TypeConverter that used Blob as its database class. Properly convert the blob to a hex string using a super-efficient algorithm.
    2. Fixed null values as strings that would insert 'null' instead of the database NULL, which could lead to head-scratching why a query like SQLite.delete(SomeTable.class).where(SomeTable_Table.column.eq(null)).execute() would fail to delete in some scenarios.
    3. _Table classes now give you access to an array of IProperty from the table via getAllColumnProperties(). Useful in queries or table information.
    4. Can attached queries as properties now: SQLite.select(SQLite.select().from(SomeTable.class).where(..)).from(SomethingElse.class).... (SELECT (SELECT * From...))
    5. Doc improvements, bug fixes and more.
    Source code(tar.gz)
    Source code(zip)
Owner
Andrew Grosner
Head of Web Development @fuzz-productions Android (Kotlin), iOS (Swift), Front-End Web (React, Angular, Typescript)
Andrew Grosner
LiteOrm is a fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line of code efficiently.

#LiteOrm:Android高性能数据库框架 A fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line

马天宇 1.5k Nov 19, 2022
greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.

Check out ObjectBox Check out our new mobile database ObjectBox (GitHub repo). ObjectBox is a superfast object-oriented database with strong relation

Markus Junginger 12.6k Jan 3, 2023
AndroidQuery is an Android ORM for SQLite and ContentProvider which focuses on easy of use and performances thanks to annotation processing and code generation

WARNING: now that Room is out, I no longer maintain that library. If you need a library to easy access to default android ContentProvider, I would may

Frédéric Julian 19 Dec 11, 2021
a 3d database ORM experiment. (used in two commercial projects)

Android-TriOrm a 3d database ORM experiment for Android. (used in two commercial projects). based around small tables concept and JVM Serialization. H

Tomer Shalev 19 Nov 24, 2021
ORMDroid is a simple ORM persistence framework for your Android applications.

ORMDroid is a simple ORM persistence framework for your Android applications, providing an easy to use, almost-zero-config way to handle model persist

Ross Bamford 87 Nov 10, 2022
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

Ahmet Alp Balkan 246 Nov 20, 2022
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

Ahmet Alp Balkan 246 Nov 20, 2022
An ORM for Android with type-safety and painless smart migrations

Android Orma Orma is a ORM (Object-Relation Mapper) for Android SQLiteDatabase. Because it generates helper classes at compile time with annotation pr

The Maskarade project 440 Nov 25, 2022
Android ORM

Shillelagh Shillelagh is an sqlite library. It was built to make life easier. The entire library was built around simplicity when using sqlite in Andr

Andrew Reitz 49 Sep 11, 2020
Compile-time active record ORM for Android

Ollie Compile-time active record ORM for Android. Multiple mapping methods. SQLiteDatabase-like interface (QueryUtils.java). Lightweight query builder

Michael Pardo 423 Dec 30, 2022
Performance comparison of Android ORM Frameworks

Performance comparison of Android ORM Frameworks At the moment there are a lot of ORM-libraries for the Android OS. We reviewed the most popular ones

Alexey Zatsepin 328 Dec 21, 2022
JAKO: Just Another Kotlin Orm (PostgreSQL)

JAKO: Just Another Kotlin Orm (PostgreSQL) JAKO is a simple, minimal, no-dependency library to build and execute postgresql statements using a fluent

Alessio 6 May 27, 2022
A simple ToDo app to demonstrate the use of Realm Database in android to perform some basic CRUD operations like Create, Update and Delete.

Creating a Realm Model Class @RealmClass open class Note() : RealmModel { @PrimaryKey var id: String = "" @Required var title: String

Joel Kanyi 15 Dec 18, 2022
SquiDB is a SQLite database library for Android and iOS

Most ongoing development is currently taking place on the dev_4.0 branch. Click here to see the latest changes and try out the 4.0 beta. Introducing S

Yahoo 1.3k Dec 26, 2022
An Android library that makes developers use SQLite database extremely easy.

LitePal for Android 中文文档 LitePal is an open source Android library that allows developers to use SQLite database extremely easy. You can finish most o

Lin Guo 7.9k Dec 31, 2022
An Android library that makes developers use SQLite database extremely easy.

LitePal for Android 中文文档 LitePal is an open source Android library that allows developers to use SQLite database extremely easy. You can finish most o

Lin Guo 7.9k Jan 4, 2023
A simple NoSQL client for Android. Meant as a document store using key/value pairs and some rudimentary querying. Useful for avoiding the hassle of SQL code.

SimpleNoSQL A simple NoSQL client for Android. If you ever wanted to just save some data but didn't really want to worry about where it was going to b

Colin Miller 389 Sep 25, 2022
An Android helper class to manage database creation and version management using an application's raw asset files

THIS PROJECT IS NO LONGER MAINTAINED Android SQLiteAssetHelper An Android helper class to manage database creation and version management using an app

Jeff Gilfelt 2.2k Dec 23, 2022
Insanely easy way to work with Android Database.

Sugar ORM Insanely easy way to work with Android databases. Official documentation can be found here - Check some examples below. The example applicat

null 2.6k Dec 16, 2022