Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Spring Data Repositories - A Deep Dive
Search
Oliver Drotbohm
April 04, 2013
Programming
4
170
Spring Data Repositories - A Deep Dive
Slides of my talk at BedCon 2013 in Berlin, Germany.
Oliver Drotbohm
April 04, 2013
Tweet
Share
More Decks by Oliver Drotbohm
See All by Oliver Drotbohm
It Takes Two to Tango – Designing Module Interactions in Modulithic Spring Applications
olivergierke
5
710
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
940
Spring Modulith – A Deep Dive
olivergierke
8
4.4k
Spring for the Architecturally Curious Developer
olivergierke
5
1.8k
Spring Boot 3 & Spring Framework 6
olivergierke
4
2k
Architecturally-evident Java Applications with jMolecules
olivergierke
9
2.9k
A Deep Dive into Spring Application Events
olivergierke
12
3.3k
Building Better Monoliths – Modulithic Applications with Spring Boot
olivergierke
4
970
Spring HATEOAS – Hypermedia APIs with Spring
olivergierke
1
750
Other Decks in Programming
See All in Programming
JSONataを使ってみよう Step Functionsが楽しくなる実践テクニック #devio2025
dafujii
0
230
Laravel Boost 超入門
fire_arlo
2
170
フロントエンドのmonorepo化と責務分離のリアーキテクト
kajitack
2
150
AIでLINEスタンプを作ってみた
eycjur
1
220
STUNMESH-go: Wireguard NAT穿隧工具的源起與介紹
tjjh89017
0
390
Claude Codeで実装以外の開発フロー、どこまで自動化できるか?失敗と成功
ndadayo
3
1.8k
FindyにおけるTakumi活用と脆弱性管理のこれから
rvirus0817
0
320
オープンセミナー2025@広島「君はどこで動かすか?」アンケート結果
satoshi256kbyte
0
230
レガシープロジェクトで最大限AIの恩恵を受けられるようClaude Codeを利用する
tk1351
4
1.5k
機能追加とリーダー業務の類似性
rinchoku
0
160
Trem on Rails - Prompt Engineering com Ruby
elainenaomi
1
100
為你自己學 Python - 冷知識篇
eddie
1
310
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
696
190k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
185
54k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
284
13k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Visualization
eitanlees
147
16k
Git: the NoSQL Database
bkeepers
PRO
431
66k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Documentation Writing (for coders)
carmenintech
73
5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Fireside Chat
paigeccino
39
3.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Transcript
Spring Data Repositories A Deep Dive Oliver Gierke
Oliver Gierke Spring Data engineer Core / JPA / Mongo
JPA Expert Group
[email protected]
www.olivergierke.de olivergierke
Hands on
Sample code https://github.com/olivergierke/ repositories-deepdive
Step 0 Initial project setup
Summary Use kickstart projects to ease setup
Step 1 Basic JPA infrastructure setup
"Persistence technology of choice is JPA. e application uses JavaConfig
and sample data contained in data.sql.
Summary Easy setup through JavaConfig XML-less JPA configuration
Step 2 Quickstart
"e implementation of the persistence layer will be based on
the Spring Data repositories abstraction. Customers can be saved, looked up by their id, email address.
Summary Interface-based programming model No implementation required Queries derived from
method names
Step 3 Extended CRUD methods
" Customers can be deleted and obtained all at once.
Summary Switched to CrudRepository Exposed CRUD methods Broad API exposed
Step 4 Pagination
"Customers can be accessed page by page.
Summary Switched to PagingAndSortingRepository Exposed CRUD methods and paging ones
Broad API exposed
Step 5 Re-declaring existing CRUD methods
"CustomerRepository.findAll() should rather return a List. e transaction timeout for
save(…) should be customized to 10 seconds.
Summary Re-declare methods to customize Return types Annotation config (Tx,
Locking)
Step 6 Introducing a read-only repository base interface
"Products shall be accessible in read-only mode only.
Summary Craft custom base interface Annotation config (Tx, Locking)
Step 7 Using manually defined queries
"As a user, I want to look up products by
their custom attributes.
Summary @Query annotation JPA named queries Spring Data named queries
Step 8 Flexible predicate execution
"As a user, I want to search for customers by
firstname, lastname, email address and any combination of them
Summary Querydsl - type safe queries for Java QuerydslPredicateExecutor
Side track: Repository proxies
Proxy mechanism Using Spring's JDK proxy support Bootstrap through Factory
Spring FactroyBean / CDI XML namespace / @EnableRepositories
Proxy mechanism Query interface CRUD implementation class QueryDslPredicateExecutor Custom implementation
extension
Step 9 Custom implementations for repositories
"As an admin user, I'd like to delete all products
beyond a given price.
Summary Provide custom implementation Base class support (Querydsl)
Stuff on top Spring MVC integration Spring Data REST Spring
Roo
Up and beyond
Supported modules JPA MongoDB Neo4j Gemfire
Community implementations Spring Data Solr Couchbase Elasticsearch FuzzyDB
Summary
Interface-based programming model
Start simple, get more sophisticated
Declarative query execution
Flexible predicate execution
Custom implementation
CDI integration
Spring Data Modern Data Access For Enterprise Java NoSQL JPA
JDBC Redis Big Data Hadoop HBase MongoDB Neo4j REST exporter Roo Hive Pig Querydsl Repositories Gemfire Splunk
Spring Data Book http://bit.ly/sd-book
Questions?
Thank you!
Code https://github.com/olivergierke/ repositories-deepdive https://github.com/olivergierke/ spring-restbucks