I would use the Spring Data API, which makes it super easy to access databases. For a traditional relational database you would use Spring Data JPA. All you need to do is define an interface and declare methods to do queries in that interface - you don't need to implement the interface, because Spring does that automatically for you. By inspecting the name of the method, Spring knows what query you want. (You can also define queries yourself for more complicated cases).