文件名称:
针对JPA的活动记录模式ActiveJPA.zip
开发工具:
文件大小: 247kb
下载次数: 0
上传时间: 2019-07-19
详细说明: 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 orders = Order.where("customer_email", "dummyemaildummy.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 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", "dummyemaildummy.com", "status", "shipped"); // Get the unique order matching the conditions Long count = Order.one("customer_email", "dummyemaildummy.com", "status", "shipped"); // Dump everything List 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 attributes = new HashMap(); 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); .... .... 标签:ActiveJPA
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
相关搜索: