Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
falkappel edited this page May 11, 2016 · 30 revisions

Get started

Downloading the needed artifacts

Setting up droitatedDB in your IDE

Tutorial

News

24.03.2016 - Support for different application ids

droitatedDB now support apps with different aplication ids in different flavours.

18.12.2015 - Rename complete

The renaming of the project is now complete. Please update your dependencies to use droitatedDB from this point forward.

14.11.2014 - Released Version 0.1.3 of Datarobot

This release contains a new feature for validating @Entities before storing them into the database. You can annotate your columns within an entity to perform data validation. A tutorial how it is being used can be found here.

@Entity
public class ValidatingEntity {
    ...
    @Column
    @NotNull
    @Min(4)
    @Max(25)
    private Integer foo;
    ...
}

Besides the new feature bugfixes are included as well.

06.06.2014 - Released Version 0.1.1 of the Datarobot API

The release contains some bugfixes with relationships and also removes the necessity to call the close method on the EntityService. Therefore a ConnectedEntityService is introduced, which keeps a longer connection to the database if needed.

Example

Here are some short code samples, so you can get an impression of how to use droitatedDB. If you want a more detailed explanation check out the Tutorial.

The droitatedDB configuration

@Update
@Persistence(dbName = "my_database.db", dbVersion = 1)
public class PersistenceConfig implements DbUpdate {
    @Override
    public void onUpdate(SQLiteDatabase db, int oldVersion, int newVersion) {
        // here you can put your update code, when changing the database version
    }
}

A simple entity

@Entity
public class User {
   @PrimaryKey
   @AutoIncrement
   @Column
   private Integer _id;
   @Column
   private String name;

   ...
}

Using the entity to store and retrieve data

User newUser = new User();
newUser.setName("user #1")

EntityService userService = new EntityService(this, User.class);
userService.save(newUser);
EntityService userService = new EntityService(this, User.class);
List<User> allUsers = userService.get();