- 授权协议: Apache
- 开发语言: Java
- 操作系统: 跨平台
- 软件首页: https://github.com/ActiveJpa/activejpa
- 软件文档: https://github.com/ActiveJpa/activejpa
软件介绍
ActiveJPA基于JPA,提供了Martin Fowler所提出的活动记录模式(Active Record pattern)的Java实现。借助于ActiveJPA,模型本身会作为DAO并与数据库交互,这样就不需要额外的代码作为数据访问层了。
ActiveJPA使用到了JPA规范,因此所有JPA的ORM实现(Hibernate、EclipseLink、OpenJPA等)都可以与ActiveJPA协同使用。
示例代码:
// Get order by id
Order order = Order.findById(12345L);
// Get all orders for a customer that are shipped
List<Order> orders = Order.where("customer_email", "dummyemail@dummy.com", "status", "shipped");
// Get all orders for the product category 'books' and paginate it
Filter filter = new Filter();
filter.setPageNo(1);
filter.setPerPage(25);
filter.addCondition(new Condition("orderItems.product.category", Operator.eq, "books");
List<Order> orders = Order.where(filter);
// Count of orders matching the filter
Long count = Order.count(filter);
// Get the first order matching the filter
Long count = Order.first("customer_email", "dummyemail@dummy.com", "status", "shipped");
// Get the unique order matching the conditions
Long count = Order.one("customer_email", "dummyemail@dummy.com", "status", "shipped");
// Dump everything
List<Order> orders = Order.all();
// Delete all orders matching the filter
Long count = Order.deleteAll(filter);
// Check if order exists with the given identifier
boolean exists = Order.exists(1234L);
// Save order
order.setBillingAmount(1000.0);
order.persist();
// Delete order
order.delete();
// Update attributes
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("billingAmount", 1000.0);
order.updateAttributes(attributes);
// Find order item by id within an order
order.collections("order_items").findById(123L);
// Search order items by filter with an order
order.collections("order_items").findById(filter);
....
....
Haskell趣学指南
[斯洛文尼亚] Miran Lipovaca / 李亚舟、宋方睿 / 人民邮电出版社 / 2014-1
《haskell趣学指南》是一本讲解haskell这门函数式编程语言的入门指南,语言通俗易懂,插图生动幽默,示例短小清晰,结构安排合理。书中从haskell的基础知识讲起,涵盖了所有的基本概念和语法,内容涉及基本语法、递归、类型和类型类、函子、applicative 函子、monad、zipper及所有haskell重要特性和强大功能。 《haskell趣学指南》适合对函数式编程及haske......一起来看看 《Haskell趣学指南》 这本书的介绍吧!
