[英]Spring data repository methods implementation
I'm working in a personal web project and I would like to use Spring Data and JPA. 我正在一个个人Web项目中工作,我想使用Spring Data和JPA。 I found this nice blog entry in springsource.com and I've spent several hours trying to understand how this work and why they do it this way. 我在springsource.com上找到了这个不错的博客条目 ,并且花了几个小时试图了解它的工作原理以及为什么这样做。 I need help with two questions mainly: 我主要需要解决两个问题:
As I said I've been looking for a good article to find answers to my questions but most of them seem that are following these one. 正如我说的那样,我一直在寻找一篇不错的文章来找到我的问题的答案,但大多数问题似乎都在追随这些问题。 I've also checked github code of the article's project but it's uncomplete. 我还检查了该项目的github代码,但这还不完整。 I hope you can help me. 我希望你能帮助我。
The point of the blog post is to talk about spring-data repositories. 博客文章的重点是讨论Spring数据存储库。 So it doesn't elaborate on why services are necessary. 因此,它没有详细说明为什么需要服务。
They are because a typical business method will deal with several DAOs/Repositories, in a single transaction. 这是因为一种典型的业务方法将在一次交易中处理多个DAO /存储库。 For example, transferring money might include calling the AccountRepository, the AudiRepository and the CustomerRepository. 例如,转帐可能包括调用AccountRepository,AudiRepository和CustomerRepository。 The service's main goal is to provide transactional business methods to the presentation layer. 该服务的主要目标是向表示层提供事务性业务方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.