<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/spring-boot-build-url-shortener-application---part-11-working-with-db-using-jdbcclient-kqlqgeqvo" -->

---
title: Spring Boot: Build URL Shortener Application - Part 11:...
description: A tutorial video walks through building user registration for a Spring Boot URL shortener application, then rewrites the user repository to use Spring's...
canonical: https://daily.dev/posts/spring-boot-build-url-shortener-application---part-11-working-with-db-using-jdbcclient-kqlqgeqvo
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Spring Boot: Build URL Shortener Application - Part 11: Working with DB using JdbcClient | daily.dev
og:description: A tutorial video walks through building user registration for a Spring Boot URL shortener application, then rewrites the user repository to use Spring's...
og:url: https://daily.dev/posts/spring-boot-build-url-shortener-application---part-11-working-with-db-using-jdbcclient-kqlqgeqvo
og:image: https://api.daily.dev/og/posts/kQlQGEQvo.png
og:image:alt: Spring Boot: Build URL Shortener Application - Part 11: Working with DB using JdbcClient
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Spring Boot: Build URL Shortener Application - Part 11: Working with DB using JdbcClient

**[SivaLabs \(YouTube\)](https://daily.dev/sources/sivalabs-youtube)** · 17 min read · 0 upvotes · 0 comments

## Summary

A tutorial video walks through building user registration for a Spring Boot URL shortener application, then rewrites the user repository to use Spring's JdbcClient instead of Spring Data JPA. It covers implementing registration with validation, password encoding, and role assignment, then demonstrates converting JPA repository methods (save, findById, existsByEmail) into raw SQL operations using JdbcClient's fluent API, including named parameters, row mappers, and retrieving auto-generated keys with GeneratedKeyHolder. The piece notes JdbcClient was introduced in Spring Framework 6.1 as a more modern alternative to JdbcTemplate.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=A8AmAmqA6uQ>

## Questions this post answers

### What is Spring's JdbcClient and how is it different from JdbcTemplate?

JdbcClient is a modern, fluent API for database access introduced in Spring Framework 6.1, offering a more developer-friendly alternative to the older JdbcTemplate. It still handles low-level connection management and transactions but exposes a chainable API using methods like sql(), param(), and query() instead of JdbcTemplate's more verbose style. It requires no extra dependency when Spring Data JPA is already included, since JdbcClient is auto-configured alongside it.

_Developers weighing JdbcTemplate against JdbcClient can track how Spring's data-access APIs evolve on daily.dev._

### How do I retrieve an auto-generated primary key after an insert using Spring JdbcClient?

Use a GeneratedKeyHolder together with JdbcClient's update() call, specifying the insert SQL and named parameters, then pass the keyholder into update(). After execution, the generated ID can be retrieved via keyholder.getKeys() and cast to the appropriate type, such as Long, for use in the application, for example logging or returning the new record's ID.

_Anyone wiring up insert-and-return-id logic in Spring can compare approaches like this via daily.dev._

## Similar posts on daily.dev

- [Using Spring Data JDBC With Kotlin](https://daily.dev/posts/using-spring-data-jdbc-with-kotlin-jtkj8jwli) · JetBrains · 0 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java), [#database](https://daily.dev/tags/database), [#spring](https://daily.dev/tags/spring), [#spring-boot](https://daily.dev/tags/spring-boot)

[View this post on daily.dev](https://daily.dev/posts/spring-boot-build-url-shortener-application---part-11-working-with-db-using-jdbcclient-kqlqgeqvo)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Spring Boot: Build URL Shortener Application - Part 11: Working with DB using JdbcClient","url":"https://daily.dev/posts/spring-boot-build-url-shortener-application---part-11-working-with-db-using-jdbcclient-kqlqgeqvo","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/spring-boot-build-url-shortener-application---part-11-working-with-db-using-jdbcclient-kqlqgeqvo"},"datePublished":"2026-09-27T07:26:37.992Z","dateModified":"2026-09-27T07:53:34.364Z","description":"A tutorial video walks through building user registration for a Spring Boot URL shortener application, then rewrites the user repository to use Spring's...","image":"https://i.ytimg.com/vi/A8AmAmqA6uQ/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/A8AmAmqA6uQ/sddefault.jpg","isAccessibleForFree":true,"articleSection":"SivaLabs (YouTube)","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"SivaLabs (YouTube)","logo":"https://media.daily.dev/image/upload/s--8ATVo4an--/f_auto,q_auto/v1790493987/logos/sivalabs-youtube?_a=BAMAMicg0","url":"https://daily.dev/sources/sivalabs-youtube"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/spring-boot-build-url-shortener-application---part-11-working-with-db-using-jdbcclient-kqlqgeqvo","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,database,spring,spring-boot","timeRequired":"PT17M","video":{"@type":"VideoObject","name":"Spring Boot: Build URL Shortener Application - Part 11: Working with DB using JdbcClient","description":"A tutorial video walks through building user registration for a Spring Boot URL shortener application, then rewrites the user repository to use Spring's...","thumbnailUrl":"https://i.ytimg.com/vi/A8AmAmqA6uQ/sddefault.jpg","uploadDate":"2026-09-27T07:26:37.992Z","duration":"PT17M","url":"https://api.daily.dev/r/kQlQGEQvo","embedUrl":"https://www.youtube.com/embed/A8AmAmqA6uQ"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SivaLabs (YouTube)","item":"https://daily.dev/sources/sivalabs-youtube"},{"@type":"ListItem","position":3,"name":"Spring Boot: Build URL Shortener Application - Part 11: Working with DB using JdbcClient"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/spring-boot-build-url-shortener-application---part-11-working-with-db-using-jdbcclient-kqlqgeqvo#faq","mainEntity":[{"@type":"Question","name":"What is Spring's JdbcClient and how is it different from JdbcTemplate?","acceptedAnswer":{"@type":"Answer","text":"JdbcClient is a modern, fluent API for database access introduced in Spring Framework 6.1, offering a more developer-friendly alternative to the older JdbcTemplate. It still handles low-level connection management and transactions but exposes a chainable API using methods like sql(), param(), and query() instead of JdbcTemplate's more verbose style. It requires no extra dependency when Spring Data JPA is already included, since JdbcClient is auto-configured alongside it. Developers weighing JdbcTemplate against JdbcClient can track how Spring's data-access APIs evolve on daily.dev."}},{"@type":"Question","name":"How do I retrieve an auto-generated primary key after an insert using Spring JdbcClient?","acceptedAnswer":{"@type":"Answer","text":"Use a GeneratedKeyHolder together with JdbcClient's update() call, specifying the insert SQL and named parameters, then pass the keyholder into update(). After execution, the generated ID can be retrieved via keyholder.getKeys() and cast to the appropriate type, such as Long, for use in the application, for example logging or returning the new record's ID. Anyone wiring up insert-and-return-id logic in Spring can compare approaches like this via daily.dev."}}]}
```

