DEV Community

Ram kethireddy
Ram kethireddy

Posted on

JDBC client spring boot

Spring jdbc in spring boot 3.2 and spring framework 6.2 upgraded to fluent style api
which is quite intuitive and easy to understand
but if we are not careful in looking at what the methods are offering when using them we might encounter strange results
example when we need single result from data base query we have this method in jdbc client
single()

which returns a single row and if not returning single row , it will throw
IncorrectResultSizeDataAccessException

to fix this we have to get use optional() and return desired result when there is no rows expected from the result set

Top comments (0)