最权威的一手资料留个底

网址: https://spring.io/guides/gs/accessing-data-jpa/

Spring Data JPA focuses on using JPA to store data in a relational database. Its most compelling feature is the ability to create repository implementations automatically, at runtime, from a repository interface.



CustomerRepository extends the CrudRepository interface. The type of entity and ID that it works with,Customer and Long, are specified in the generic parameters on CrudRepository. By extending CrudRepository, CustomerRepository inherits several methods for working with Customer persistence, including methods for saving, deleting, and finding Customer entities.

Spring Data JPA also allows you to define other query methods by simply declaring their method signature. In the case of CustomerRepository, this is shown with a findByLastName() method.

In a typical Java application, you’d expect to write a class that implements CustomerRepository. But that’s what makes Spring Data JPA so powerful: You don’t have to write an implementation of the repository interface. Spring Data JPA creates an implementation on the fly when you run the application.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,172评论 0 10
  • react官网https://www.npmjs.com/package/create-react-app rek...
    见月荒州阅读 1,279评论 0 0
  • 一、今日读《论语》一得:古之学者为己 当我读到下面这一段时,停了下来,自己的感悟也涌了出来,感觉这段话在今天的我看...
    兰亭小馆阅读 2,744评论 0 1
  • 你点了删除或者保存键,然后你就离开了,过了半天你回来时却会发现系统竟然傻傻的弹了一个对话框问你,你确认要删除或保存...
    鲜核桃阅读 3,826评论 0 0

友情链接更多精彩内容