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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Oliver Drotbohm
October 17, 2012
Programming
630
2
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 SpringOne2GX 2012.
Oliver Drotbohm
October 17, 2012
More Decks by Oliver Drotbohm
See All by Oliver Drotbohm
What's new in Spring Modulith?
olivergierke
1
360
Domain-centric? Why Hexagonal and Onion Architecture Are Answers to the Wrong Question
olivergierke
4
2.1k
It Takes Two to Tango – Designing Module Interactions in Modulithic Spring Applications
olivergierke
5
860
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
1.1k
Spring Modulith – A Deep Dive
olivergierke
9
5.9k
Spring for the Architecturally Curious Developer
olivergierke
5
2k
Spring Boot 3 & Spring Framework 6
olivergierke
4
2.1k
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
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
250
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.4k
Are APIs Still Relevant in the AI Era?
soyuka
0
290
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
150
スマート反転とウェブアクセシビリティ
camiha
0
210
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
250
Family mrubyの進捗
kishima
1
130
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
150
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
560
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
3.1k
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
220
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
310
Featured
See All Featured
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
250
Paper Plane (Part 1)
katiecoart
PRO
2
11k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Are puppies a ranking factor?
jonoalderson
2
3.9k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Building an army of robots
kneath
307
46k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
900
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Designing Experiences People Love
moore
143
24k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
Transcript
Spring Data Repositories A Deep Dive Oliver Gierke, Senior Member
Technical Staff
[email protected]
- @olivergierke © 2012 SpringOne 2GX. All rights reserved. Do not distribute without permission.
2 Oliver Gierke Spring Source engineer Project lead Core/JPA/MongoDB
[email protected]
www.olivergierke.de olivergierke
3 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 1 free copy per attendee! Gemfire Splunk
4 Hands on
Sample code https://github.com/olivergierke/repositories-deepdive 5
6 Step 0 Initial project setup
7 Summary Use kickstart projects to ease setup
8 Step 1 Basic JPA infrastructure setup
9 " Persistence technology of choice is JPA. e application
uses JavaConfig and sample data contained in data.sql.
10 Summary Easy setup through JavaConfig XML-less JPA configuration
11 Step 2 Quickstart
12 " 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.
13 Summary Interface-based programming model No implementation required Queries derived
from method names
14 Step 3 Extended CRUD methods
15 " Customers can be deleted and obtained all at
once.
16 Summary Switched to CrudRepository Exposed CRUD methods Broad API
exposed
17 Step 4 Pagination
18 " Customers can be accessed page by page.
19 Summary Switched to PagingAndSortingRepository Exposed CRUD methods and paging
ones Broad API exposed
20 Step 5 Re-declaring existing CRUD methods
21 " CustomerRepository.findAll() should rather return a List. e transaction
timeout for save(…) should be customized to 10 seconds.
22 Summary Re-declare methods to customize Return types Annotation config
(Tx, Locking)
23 Step 6 Introducing a read-only repository base interface
24 " Orders shall be accessible in read-only mode only.
25 Summary Craft custom base interface Return types Annotation config
(Tx, Locking)
26 Step 7 Using manually defined queries
27 " As a user, I want to look up
products by their custom attributes.
28 Summary @Query annotation JPA named queries Spring Data named
queries
29 Step 8 Flexible predicate execution
30 " As a user, I want to search for
customers by first name, last name, email address and any combination of them
31 Summary Querydsl - type safe queries for Java QuerydslPredicateExecutor
Side track: Repository proxies 32
Proxy mechanism Using Spring's JDK proxy support Bootstrap through Factory
Spring FactroyBean / CDI XML namespace / @EnableRepositories 33
Proxy mechanism Query interface CRUD implementation class QueryDslPredicateExecutor Custom implementation
extension 34
35 Step 9 Custom implementations for repositories
36 " As an admin user, I'd like to delete
all products beyond a given price.
37 Summary Provide custom implementation Base class support (Querydsl)
Stuff on top Spring MVC integration Spring Data REST Spring
Roo 38
Up and beyond 39
40 Supported modules JPA MongoDB Neo4j Gemfire
41 Community implementations Spring Data Solr FuzzyDB (Cassandra)
42 Further sessions Spring Data and Data Grids - Wed,
12:45pm Spring Data Neo4j - Wed, 2:45pm Lightning Talks - Wed, 4:30pm Spring Data REST - Thu, 12:45pm
Summary 43
Interface-based programming model 44
Start simple, get more sophisticated 45
Declarative query execution 46
Flexible predicate execution 47
Custom implementation 48
CDI integration 49