{"id":33848,"date":"2014-12-03T07:00:48","date_gmt":"2014-12-03T05:00:48","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=33848"},"modified":"2014-12-02T12:20:06","modified_gmt":"2014-12-02T10:20:06","slug":"spring-data-jpa-tutorial-introduction","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html","title":{"rendered":"Spring Data JPA Tutorial: Introduction"},"content":{"rendered":"<p>Creating repositories that use the Java Persistence API is a cumbersome process that takes a lot of time and requires a lot of boilerplate code. We can eliminate some boilerplate code by following these steps:<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<ol>\n<li>Create an abstract base repository class that provides CRUD operations for entities.<\/li>\n<li>Create the concrete repository class that extends the abstract base repository class.<\/li>\n<\/ol>\n<p>The problem of this approach is that we still have to write the code that creates our database queries and invokes them. To make matters worse, we have to do this every time when we want to create a new database query. <strong>This is a waste of time<\/strong>.<\/p>\n<p>What would you say if I would tell you that we can create JPA repositories without writing any boilerplate code?<\/p>\n<p>The odds are that you might not believe me, but Spring Data JPA helps us to do just that. <a href=\"http:\/\/projects.spring.io\/spring-data-jpa\/\" target=\"_blank\">The website of the Spring Data JPA project states that<\/a>:<\/p>\n<blockquote>\n<p>Implementing a data access layer of an application has been cumbersome for quite a while. Too much boilerplate code has to be written to execute simple queries as well as perform pagination, and auditing. Spring Data JPA aims to significantly improve the implementation of data access layers by reducing the effort to the amount that\u2019s actually needed. As a developer you write your repository interfaces, including custom finder methods, and Spring will provide the implementation automatically\n<\/p>\n<\/blockquote>\n<p>This blog post provides an introduction to Spring Data JPA. We will learn what Spring Data JPA really is and take a quick look at the Spring Data repository interfaces.<\/p>\n<p>Let\u2019s get started.<\/p>\n<h2>What Spring Data JPA Is?<\/h2>\n<p><strong>Spring Data JPA is not a JPA provider<\/strong>. It is a library \/ framework that adds an extra layer of abstraction on the top of our JPA provider. If we decide to use Spring Data JPA, the repository layer of our application contains three layers that are described in the following:<\/p>\n<ul>\n<li><a href=\"http:\/\/projects.spring.io\/spring-data-jpa\/\" target=\"_blank\">Spring Data JPA<\/a> provides support for creating JPA repositories by extending the Spring Data repository interfaces.<\/li>\n<li><a href=\"https:\/\/github.com\/spring-projects\/spring-data-commons\" target=\"_blank\">Spring Data Commons<\/a> provides the infrastructure that is shared by the datastore specific <a href=\"http:\/\/projects.spring.io\/spring-data\/\" target=\"_blank\">Spring Data projects<\/a>.<\/li>\n<li>The JPA Provider implements the Java Persistence API.<\/li>\n<\/ul>\n<p>The following figure illustrates the structure of our repository layer:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/springdatajpalayers.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33892\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/springdatajpalayers.png\" alt=\"springdatajpalayers\" width=\"380\" height=\"245\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/springdatajpalayers.png 380w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/springdatajpalayers-300x193.png 300w\" sizes=\"(max-width: 380px) 100vw, 380px\" \/><\/a><\/p>\n<h4>Additional Reading:<\/h4>\n<ul>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/16148188\/spring-data-jpa-versus-jpa-whats-the-difference\" target=\"_blank\">Spring Data JPA versus JPA: What\u2019s the difference?<\/a><\/li>\n<\/ul>\n<p>At first it seems that Spring Data JPA makes our application more complicated, and in a way that is true. It does add an additional layer to our repository layer, but at the same time it frees us from writing any boilerplate code.<\/p>\n<p>That sounds like a good tradeoff. Right?<\/p>\n<h2>Introduction to Spring Data Repositories<\/h2>\n<p>The power of Spring Data JPA lies in the repository abstraction that is provided by the Spring Data Commons project and extended by the datastore specific sub projects.<\/p>\n<p>We can use Spring Data JPA without paying any attention to the actual implementation of the repository abstraction, but we have to be familiar with the Spring Data repository interfaces. These interfaces are described in the following:<\/p>\n<p><strong>First<\/strong>, the Spring Data Commons project provides the following interfaces:<\/p>\n<ul>\n<li>The <a href=\"http:\/\/docs.spring.io\/spring-data\/commons\/docs\/current\/api\/index.html?org\/springframework\/data\/repository\/Repository.html\" target=\"_blank\"><em>Repository&lt;T, ID extends Serializable&gt;<\/em><\/a> interface is a marker interface that has two purposes:\n<ol>\n<li>It captures the type of the managed entity and the type of the entity\u2019s id.<\/li>\n<li>It helps the Spring container to discover the \u201cconcrete\u201d repository interfaces during classpath scanning.<\/li>\n<\/ol>\n<\/li>\n<li>The <a href=\"http:\/\/docs.spring.io\/spring-data\/commons\/docs\/current\/api\/org\/springframework\/data\/repository\/CrudRepository.html\" target=\"_blank\"><em>CrudRepository&lt;T, ID extends Serializable&gt;<\/em><\/a> interface provides CRUD operations for the managed entity.<\/li>\n<li>The <a href=\"http:\/\/docs.spring.io\/spring-data\/commons\/docs\/current\/api\/org\/springframework\/data\/repository\/PagingAndSortingRepository.html\" target=\"_blank\"><em>PagingAndSortingRepository&lt;T, ID extends Serializable&gt;<\/em><\/a> interface declares the methods that are used to sort and paginate entities that are retrieved from the database.<\/li>\n<li>The <a href=\"http:\/\/docs.spring.io\/spring-data\/commons\/docs\/current\/api\/org\/springframework\/data\/querydsl\/QueryDslPredicateExecutor.html\" target=\"_blank\"><em>QueryDslPredicateExecutor&lt;T&gt;<\/em><\/a> interface is not a \u201crepository interface\u201d. It declares the methods that are used to retrieve entities from the database by using <a href=\"http:\/\/www.querydsl.com\/\" target=\"_blank\">QueryDsl<\/a> <em>Predicate<\/em> objects.<\/li>\n<\/ul>\n<p><strong>Second<\/strong>, the Spring Data JPA project provides the following interfaces:<\/p>\n<ul>\n<li>The <a href=\"http:\/\/docs.spring.io\/spring-data\/jpa\/docs\/current\/api\/org\/springframework\/data\/jpa\/repository\/JpaRepository.html\" target=\"_blank\"><em>JpaRepository&lt;T, ID extends Serializable&gt;<\/em><\/a> interface is a JPA specific repository interface that combines the methods declared by the common repository interfaces behind a single interface.<\/li>\n<li>The <a href=\"http:\/\/docs.spring.io\/spring-data\/jpa\/docs\/current\/api\/org\/springframework\/data\/jpa\/repository\/JpaSpecificationExecutor.html\" target=\"_blank\"><em>JpaSpecificationExecutor&lt;T&gt;<\/em><\/a> interface is not a \u201crepository interface\u201d. It declares the methods that are used to retrieve entities from the database by using <a href=\"http:\/\/docs.spring.io\/spring-data\/jpa\/docs\/current\/api\/org\/springframework\/data\/jpa\/domain\/Specification.html\" target=\"_blank\"><em>Specification&lt;T&gt;<\/em><\/a> objects that use the JPA criteria API.<\/li>\n<\/ul>\n<p>The repository hierarchy looks as follows:<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/springdatajrepositories.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-33894\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/springdatajrepositories.png\" alt=\"springdatajrepositories\" width=\"850\" height=\"473\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/springdatajrepositories.png 989w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/springdatajrepositories-300x167.png 300w\" sizes=\"(max-width: 850px) 100vw, 850px\" \/><\/a><\/p>\n<p>That is nice, but how can we use them?<\/p>\n<p>That is a fair question. The next parts of this tutorial will answer to that question, but essentially we have to follow these steps:<\/p>\n<ol>\n<li>Create a repository interface and extend one of the repository interfaces provided by Spring Data.<\/li>\n<li>Add custom query methods to the created repository interface (if we need them that is).<\/li>\n<li>Inject the repository interface to another component and use the implementation that is provided automatically by Spring.<\/li>\n<\/ol>\n<p>Let\u2019s move on and summarize what we learned from this blog post.<\/p>\n<h2>Summary<\/h2>\n<p>This blog post has taught us two things:<\/p>\n<ul>\n<li>Spring Data JPA is not a JPA provider. It simply \u201chides\u201d the Java Persistence API (and the JPA provider) behind its repository abstraction.<\/li>\n<li>Spring Data provides multiple repository interfaces that are used for different purposes.<\/li>\n<\/ul>\n<p>The next part of this tutorial describes how we can get the required dependencies.<\/p>\n<p>If you want to know more about Spring Data JPA, you should read my <a href=\"\/spring-data-jpa-tutorial\/\" target=\"_blank\">Spring Data JPA Tutorial<\/a>.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/www.petrikainulainen.net\/programming\/spring-framework\/spring-data-jpa-tutorial-introduction\/\">Spring Data JPA Tutorial: Introduction<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\/\">JCG partner<\/a> Petri Kainulainen at the <a href=\"http:\/\/www.petrikainulainen.net\/\">Petri Kainulainen<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Creating repositories that use the Java Persistence API is a cumbersome process that takes a lot of time and requires a lot of boilerplate code. We can eliminate some boilerplate code by following these steps: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Create an abstract base repository class that provides CRUD operations for entities. &hellip;<\/p>\n","protected":false},"author":429,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[30],"class_list":["post-33848","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring Data JPA Tutorial: Introduction<\/title>\n<meta name=\"description\" content=\"Creating repositories that use the Java Persistence API is a cumbersome process that takes a lot of time and requires a lot of boilerplate code. We can\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Data JPA Tutorial: Introduction\" \/>\n<meta property=\"og:description\" content=\"Creating repositories that use the Java Persistence API is a cumbersome process that takes a lot of time and requires a lot of boilerplate code. We can\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-03T05:00:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Petri Kainulainen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/petrikainulaine\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Petri Kainulainen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html\"},\"author\":{\"name\":\"Petri Kainulainen\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/5af4df3fdfeb79e9fa3598d79bff2c9e\"},\"headline\":\"Spring Data JPA Tutorial: Introduction\",\"datePublished\":\"2014-12-03T05:00:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html\"},\"wordCount\":912,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html\",\"name\":\"Spring Data JPA Tutorial: Introduction\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2014-12-03T05:00:48+00:00\",\"description\":\"Creating repositories that use the Java Persistence API is a cumbersome process that takes a lot of time and requires a lot of boilerplate code. We can\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/spring-data-jpa-tutorial-introduction.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring Data JPA Tutorial: Introduction\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/5af4df3fdfeb79e9fa3598d79bff2c9e\",\"name\":\"Petri Kainulainen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9e57425180f323fa65bc519a64c8273d3fcb7c6bd272e56b37dd15613f403659?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9e57425180f323fa65bc519a64c8273d3fcb7c6bd272e56b37dd15613f403659?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9e57425180f323fa65bc519a64c8273d3fcb7c6bd272e56b37dd15613f403659?s=96&d=mm&r=g\",\"caption\":\"Petri Kainulainen\"},\"description\":\"Petri is passionate about software development and continuous improvement. He is specialized in software development with the Spring Framework and is the author of Spring Data book.\",\"sameAs\":[\"http:\\\/\\\/www.petrikainulainen.net\\\/\",\"http:\\\/\\\/www.linkedin.com\\\/in\\\/petrikainulainen\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/petrikainulaine\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/petri-kainulainen\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Data JPA Tutorial: Introduction","description":"Creating repositories that use the Java Persistence API is a cumbersome process that takes a lot of time and requires a lot of boilerplate code. We can","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html","og_locale":"en_US","og_type":"article","og_title":"Spring Data JPA Tutorial: Introduction","og_description":"Creating repositories that use the Java Persistence API is a cumbersome process that takes a lot of time and requires a lot of boilerplate code. We can","og_url":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2014-12-03T05:00:48+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Petri Kainulainen","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/petrikainulaine","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Petri Kainulainen","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html"},"author":{"name":"Petri Kainulainen","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/5af4df3fdfeb79e9fa3598d79bff2c9e"},"headline":"Spring Data JPA Tutorial: Introduction","datePublished":"2014-12-03T05:00:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html"},"wordCount":912,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html","url":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html","name":"Spring Data JPA Tutorial: Introduction","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2014-12-03T05:00:48+00:00","description":"Creating repositories that use the Java Persistence API is a cumbersome process that takes a lot of time and requires a lot of boilerplate code. We can","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/spring-data-jpa-tutorial-introduction.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring Data JPA Tutorial: Introduction"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/5af4df3fdfeb79e9fa3598d79bff2c9e","name":"Petri Kainulainen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9e57425180f323fa65bc519a64c8273d3fcb7c6bd272e56b37dd15613f403659?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9e57425180f323fa65bc519a64c8273d3fcb7c6bd272e56b37dd15613f403659?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9e57425180f323fa65bc519a64c8273d3fcb7c6bd272e56b37dd15613f403659?s=96&d=mm&r=g","caption":"Petri Kainulainen"},"description":"Petri is passionate about software development and continuous improvement. He is specialized in software development with the Spring Framework and is the author of Spring Data book.","sameAs":["http:\/\/www.petrikainulainen.net\/","http:\/\/www.linkedin.com\/in\/petrikainulainen","https:\/\/x.com\/https:\/\/twitter.com\/petrikainulaine"],"url":"https:\/\/www.javacodegeeks.com\/author\/petri-kainulainen"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/33848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/429"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=33848"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/33848\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=33848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=33848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=33848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}