美文网首页
最权威的一手资料留个底

最权威的一手资料留个底

作者: 无羡爱诗诗 | 来源:发表于2018-12-20 16:34 被阅读17次

    网址: 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.

    相关文章

      网友评论

          本文标题:最权威的一手资料留个底

          本文链接:https://www.haomeiwen.com/subject/qaaykqtx.html