| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
12年前发布

Java轻量级ORM持久层框架:ORMLite

ORMLite是一个轻量级的Java对象关系映射持久层框架。支持包括 MySQL、Postgres、Microsoft SQL Server、H2、Derby、HSQLDB和Sqlite等在内的数据库。提供灵活的QueryBuilder来构建复杂的数据查询。强大的抽象 DAO类,只需5行代码便能够自动生成SQL来创建和删除数据库表格。
RMLite易于使用并提供了以下特性:

  • 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.
  • Supports native calls to Android SQLite database APIs

示例代码:

public class AccountApp {        public static void main(String[] args) throws Exception {            // this uses h2 by default but change to match your database            String databaseUrl = "jdbc:h2:mem:account";            // create a connection source to our database            ConnectionSource connectionSource = new JdbcConnectionSource(databaseUrl);            // instantiate the dao            AccountDaoImpl accountDao = new AccountDaoImpl(connectionSource);            // if you need to create the 'accounts' table make this call            TableUtils.createTable(connectionSource, Account.class);

项目主页:http://www.open-open.com/lib/view/home/1357891151200

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1357891151200.html
ORM 持久层框架