[JAVA] [Note] I want to get in reverse order using afterLast with JdbcTemplate

I used JdbcTemplate in SpringBoot, and there was a case where I wanted to get the results in reverse order, so I recorded it as a memorandum. I think there is a clue that you should get it by order by, but in rare cases where you cannot simply sort by order by (for example, when you express a hierarchical structure using recursive). Encounter.

Classes and methods to use

code

SqlRowSet rs = jdbcTemplate.queryForRowSet(sql, param);
rs.afterLast();
while(rs.previous()) {
  //You can take the opposite here
  //For example rs.getString("name");
}

Recommended Posts

[Note] I want to get in reverse order using afterLast with JdbcTemplate
I want to get the value in Ruby
I want to get along with Map [Java beginner]
I want to find a relative path in a situation using Path
Even in Java, I want to output true with a == 1 && a == 2 && a == 3
I tried to get started with Swagger using Spring Boot
[Ruby] I want to reverse the order of the hash table
I want to make a button with a line break with link_to [Note]
I want to get some properties as JSON strings in Jackson!
[Java] I want to perform distinct with the key in the object
[Android] I want to get the listener from the button in ListView
I tried to get started with WebAssembly
I want to use DBViewer with Eclipse 2018-12! !!
[Note] How to get started with Rspec
I want to use @Autowired in Servlet
I summarized the points to note when using resources and resources in combination
I want to select multiple items with a custom layout in Dialog
[Ruby] I want to display posted items in order of newest date
I want to display a PDF in Chinese (Korean) with thin reports
I want to get the IP address when connecting to Wi-Fi in Java
I want to ForEach an array with a Lambda expression in Java
I want to use arrow notation in Ruby
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (Javassist second decoction)
I want to be able to read a file using refile with administrate [rails6]
I want to use java8 forEach with index
I want to pass APP_HOME to logback in Gradle
rsync4j --I want to touch rsync in Java.
I want to play with Firestore from Rails
[Xcode] I want to manage images in folders
I want to be eventually even in kotlin
I want to perform aggregation processing with spring-batch
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (black magic edition)
[Rails] I want to load CSS with webpacker
I want to get the information of the class that inherits the UserDetails class of the user who is logged in with Spring Boot.
I want to change the path after new registration after logging in with multiple devises.
I want to return an object in CSV format with multi-line header & filter in Java
# 1_JAVA I want to get the index number by specifying one character in the character string.
How to sort in ascending / descending order with SQLite
I want to use Combine in UIKit as well.
I want to use Clojure's convenient functions in Kotlin
I want to use fish shell in Laradock too! !!
I want to use ES2015 in Java too! → (´ ・ ω ・ `)
# 2 [Note] I tried to calculate multiplication tables in Java.
I want to judge the range using the monthly degree
I want to use a little icon in Rails
I tried to get started with Spring Data JPA
I want to dark mode with the SWT app
I want to monitor a specific file with WatchService
I want to authenticate users to Rails with Devise + OmniAuth
Where to get lost in specifications with Spark routing
I want to define a function in Rails Console
I want to transition screens with kotlin and java!
I want to stop snake case in table definition
I want to call the main method using reflection
I want to click a GoogleMap pin in RSpec
I want to redirect sound from Ubuntu with xrdp
[Ruby on Rails] I want to get the URL of the image saved in Active Storage
After posting an article with Rails Simple Calendar, I want to reflect it in the calendar.
[Java] I want to write asynchronous processing using Promise in Java-Trial of Promise-like grammar of JavaScript-
I want to Flash Attribute in Spring even if I set a reverse proxy! (do not do)
I want to recreate the contents of assets from scratch in the environment built with capistrano