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
October 17, 2012
Programming
2
610
Spring Data Repositories - A Deep Dive
Slides of my talk at SpringOne2GX 2012.
Oliver Drotbohm
October 17, 2012
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
670
Bottom-Up Architecture – Bridging the Achitecture Code Gap
olivergierke
4
920
Spring Modulith – A Deep Dive
olivergierke
8
4.3k
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
950
Spring HATEOAS – Hypermedia APIs with Spring
olivergierke
1
740
Other Decks in Programming
See All in Programming
Deep Dive into ~/.claude/projects
hiragram
7
1.3k
VS Code Update for GitHub Copilot
74th
1
320
XSLTで作るBrainfuck処理系
makki_d
0
210
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
340
「ElixirでIoT!!」のこれまでとこれから
takasehideki
0
370
Julia という言語について (FP in Julia « SIDE: F ») for 関数型まつり2025
antimon2
3
980
ruby.wasmで多人数リアルタイム通信ゲームを作ろう
lnit
2
250
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
140
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
1
320
git worktree × Claude Code × MCP ~生成AI時代の並列開発フロー~
hisuzuya
1
450
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
190
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
130
Featured
See All Featured
A better future with KSS
kneath
239
17k
Embracing the Ebb and Flow
colly
86
4.7k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Bash Introduction
62gerente
614
210k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
124
52k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
The Pragmatic Product Professional
lauravandoore
35
6.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Thoughts on Productivity
jonyablonski
69
4.7k
Gamification - CAS2011
davidbonilla
81
5.3k
Raft: Consensus for Rubyists
vanstee
140
7k
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