ORMLite 介绍
Ormlite是一个轻量级的Java对象关系映射持久层框架。支持包括 MysqL、Postgres、Microsoft sql
Server、H2、Derby、HsqlDB和sqlite等在内的数据库。提供灵活的QueryBuilder来构建复杂的数据查询。强大的抽象DAO类,只需5行代码便能够自动生成sql来创建和删除数据库表格。
示例代码:
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);
ORMLite 官网
http://ormlite.sourceforge.net/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。