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.

Pleasecontact mewith 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 repositorycentral maven repositorySourceForge files

  • Documentation:

    • Getting StartedHTMLPDF

    • Javadocs: corejdbcandroid

    • Code Examples

    • Change log file

    • Open source license (ISC)

    • SQL Data Types

  • Support:

    • Google Groups mailing lists: usersandroid usersdevelopers

    • Bug tracking site

    • Stackoverflow questions

    • SourceForge project page

  • Source control (GIT): corejdbcandroid

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")publicclassAccount{@DatabaseField(id=true)privateStringname;@DatabaseField(canBeNull=false)privateStringpassword;...Account(){//allpersistedclassesmustdefineano-argconstructorwithatleastpackagevisibility}...}

Classes can also be configured with javax.persistence annotations, Java calls, or Spring wiring. For more details, see theonline 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 byGray Watsonunder theCreative Commons Attribution-Share Alike 3.0 License.
This page should beW3C Valid XHTMLand should work with most browsers.
http://ormlite.com/sqlite_java_android_orm.shtml

FreeSpamProtectionEggnog RecipeAndroid ORMSimple Java MagicJMX using HTTPOAuth 2.0 Simple ExampleGreat 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

更多相关文章

  1. 1.0 Kotlin-Android开发简介
  2. Android自动测试之benchmark test 简介
  3. Android Activity 简介
  4. 【Android 内存优化】Bitmap 长图加载 ( BitmapRegionDecoder 简
  5. Android提供的LruCache类简介
  6. Android之SharedPreferences简介及使用说明
  7. React Native 官方文档中文版(含最新Android内容)
  8. Android 统计图表引擎 AChartEngine (一) -简介

随机推荐

  1. sqlldr装载数据实现代码
  2. Sql Server触发器的使用
  3. jdbc连接sql server数据库问题分析
  4. SQL Server高可用的常见问题分析
  5. sql处理数据库锁的存储过程分享
  6. SQLSERVER 本地查询更新操作远程数据库的
  7. sql 查询记录数结果集某个区间内记录
  8. sql server 表结构修改方法
  9. MSSQL数据库排序规则如何更改
  10. mssql2005,2008导出数据字典实现方法