Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Spring Data Repositories - A Deep Dive
Search
Oliver Drotbohm
April 04, 2013
Programming
190
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Spring Data Repositories - A Deep Dive
Slides of my talk at BedCon 2013 in Berlin, Germany.
Oliver Drotbohm
April 04, 2013
More Decks by Oliver Drotbohm
See All by Oliver Drotbohm
What's new in Spring Modulith?
olivergierke
1
390
Domain-centric? Why Hexagonal and Onion Architecture Are Answers to the Wrong Question
olivergierke
4
2.2k
It Takes Two to Tango – Designing Module Interactions in Modulithic Spring Applications
olivergierke
5
870
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
1.1k
Spring Modulith – A Deep Dive
olivergierke
9
6.1k
Spring for the Architecturally Curious Developer
olivergierke
5
2k
Spring Boot 3 & Spring Framework 6
olivergierke
4
2.2k
Architecturally-evident Java Applications with jMolecules
olivergierke
9
3.2k
A Deep Dive into Spring Application Events
olivergierke
12
3.6k
Other Decks in Programming
See All in Programming
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
250
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
200
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
4
1.5k
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
310
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
190
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
5
780
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
140
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
220
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
2.2k
Performance Optimization With LLMs
xleitix
0
240
SODA - FACT BOOK(EN)
sodainc
1
210
私なりのハーネスエンジニアリング ~独自の言語処理系の開発を通して~
seosoft
0
180
Featured
See All Featured
So, you think you're a good person
axbom
PRO
2
2.2k
Paper Plane
katiecoart
PRO
5
55k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
760
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
610
Accessibility Awareness
sabderemane
1
290
Claude Code のすすめ
schroneko
67
230k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
350
The Curse of the Amulet
leimatthew05
3
17k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
520
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