Java的ORM框架 Persist
本文导语: Persist 是一个轻量级的易用而且高性能的 Java ORM 和 DAO 框架。 示例代码: // inserts a new customer (the class Customer is mapped to the table customer automatically)persist.insert(customer);// reads a customer by its primary keyCustomer c = persist.readByPrimaryKey(Custom...
Persist 是一个轻量级的易用而且高性能的 Java ORM 和 DAO 框架。
示例代码:
// inserts a new customer (the class Customer is mapped to the table customer automatically)
persist.insert(customer);
// reads a customer by its primary key
Customer c = persist.readByPrimaryKey(Customer.class, 42);
// retrieves customers using a custom query (note the usage of varargs)
List list = persist.readList(Customer.class, "select * from customer where id > ?", 10);
// fetch all customers and assign the ResultSet to an Iterator
Iterator allCustomersIterator = persist.readIterator(Customer.class, "select * from customer");