Android ormlite 简介中文版

OrmLite - Lightweight Java ORM Supports Android and SQLite

 

Object Relational Mapping Lite (ORM Lite) provides some lightweight functionality for persisting Java objects to SQL databases while avoiding the complexity and overhead of more standard ORM packages. It supports a number of SQL databases using JDBC and also supports Sqlite with native calls to Android OS database APIs. Documentation about how to configure ORMLite for Android specifically is available in the manual.

Please contact me with any feedback or questions about Android support. See the home page for more details.

  • ORMLite home page

  • Android specific documentation in the online manual

  • Collection of example projects and classes for Android developers

  • Download files:    local repository    central maven repository    SourceForge files

  • Documentation:

    • Getting Started    HTML    PDF

    • Javadocs:    core    jdbc    android

    • Code Examples

    • Change log file

    • Open source license (ISC)

    • SQL Data Types

  • Support:

    • Google Groups mailing lists:    users    android users    developers

    • Bug tracking site

    • Stackoverflow questions

    • SourceForge project page

  • Source control (GIT):    core    jdbc    android

ORMLite provides the following features:

  • Setup your classes by simply adding Java annotations.

  • Powerful abstract Database Access Object (DAO) classes.

  • Flexible QueryBuilder to easily construct simple and complex queries.

  • Supports MySQL, Postgres, Microsoft SQL Server, H2, Derby, HSQLDB, and Sqlite and can be extended to additional databases relatively easily.

  • Provisional support for DB2, Oracle, ODBC, and Netezza. Contact the author if your database type is not supported.

  • Handles "compiled" SQL statements for repetitive query tasks.

  • Supports "foreign" objects with the class field being the object but an id stored in the database table.

  • Basic support for database transactions.

  • Auto generates SQL to create and drop database tables.

  • Spring configuration support for DOAs and class configurations.

  • Support for configuring of tables and fields without annotations.

Use Annotations to Mark Classes to be Persisted

To use the package you add the @DatabaseTable annotation to the top of each class and a @DatabaseField annotation to each of the fields in the class that are to be persisted to the database. For example:

@DatabaseTable(tableName = "accounts") 
 public class Account {
 
 @DatabaseField(id = true) 
 private String name; 
 
 @DatabaseField(canBeNull = false) 
 private String password;
  ... 
  Account() { 
  // all persisted classes must define a no-arg constructor with at least package visibility 
  } 
  ...
  
 }

Classes can also be configured with javax.persistence annotations, Java calls, or Spring wiring. For more details, see the online documentation.

Sample Code Example

The ORMLite Android code includes base activity, service, and tab classes to help create and manage your database connections and DAOs. The following is a quick code example to give you a taste on how to use the package

Android ormlite 简介中文版_第1张图片

this web page and associated content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License. 
This page should be W3C Valid XHTML and should work with most browsers. 
http://ormlite.com/sqlite_java_android_orm.shtml

Free Spam Protection   Eggnog Recipe   Android ORM   Simple Java Magic   JMX using HTTP   OAuth 2.0 Simple Example   Great Eggnog Recipe  

Your host: (none) 61.141.136.73:56001 
Your browser: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 

你可能感兴趣的:(android,ormlite简介中文版本)