Giter Club home page Giter Club logo

ormdroid's Introduction

ORMDroid is a simple ORM persistence framework for your Android applications, providing an easy to use, almost-zero-config way to handle model persistence without ever having to deal with Android's built-in database interfaces.

ORMDroid is:

  • Small - ~20k, target of no more than 30k.
  • Simple - No excessive features or support for platforms other than Android.
  • Flexible - Allowing you to configure what you need to, but at the same time...
  • Automatic - ... sensible defaults for everything.

ORMDroid works with Android API 8 and up.

Getting ORMDroid

You can either download ORMDroid from the download page, or check out of Git.

If downloading a packaged release, you'll need to unzip the file somewhere, and then import the project into your Eclipse.

Getting started

To use ORMDroid, you need to set up ORMDroid as a required library in your android app. If you're using Eclipse, go to project->properties->android and add ORMDroid as a required libray. Now, you just need to add a single XML tag to your AndroidManifest.xml as a child of the Application tag:

<meta-data
  android:name="ormdroid.database.name"
  android:value="your_database_name" />

And initialize the framework somewhere (e.g. Application.onCreate, or even in your activity's onCreate since there's no penalty for calling initialize multiple times):

ORMDroidApplication.initialize(someContext);

Then you create your model:

public class Person extends Entity {
  public int id;
  public String name;
  public String telephone;
}

And work with it as you see fit!

Person p = Entity.query(Person.class).where("id").eq("1").execute();
p.telephone = "555-1234";
p.save();

That's it! If you want more customization over e.g. table names, column names, etc, take a look at the Table and Column annotations.

There is a more detailed version of these instructions in this blog entry

Update: There is now a very simple sample app available for ORMDroid. You can get it from SVN:

svn checkout http://orm-droid.googlecode.com/svn/trunk/ORMSample

For more information, check out this blog entry.

ormdroid's People

Contributors

roscopeco avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.