Many applications store data in a relational database.
The standard JDBC API
is used to interact with relational databases, but it's a bit low level.
It's not hard to define a few helper classes that will encapsulate the bulk of repeated JDBC code.
But even so, many applications will benefit from using tools that operate on top of the JDBC API.

treat code and objects as primary (Java Persistence API and Hibernate, for example), and SQL as secondary.
These are usually referred to as Object-Relational Mapping (ORM) tools.

treat SQL as primary (IBatis and web4j, for example), and code as secondary.

Although ORM tools are currently popular,
some argue
that they should be avoided. In brief:

their performance is usually poorer than approaches based on SQL

there's usually no easy way to debug and tune queries

they usually don't support all relational databases

learning how to use them well is non-trivial

they reinvent the wheel by defining query APIs, which more or less reproduce what already exists in SQL
(an existing, widely used, and well understood language for the manipulation of data)

they sometimes prevent you from defining your Model Objects as immutable, or otherwise leak into your Model Object

As an example of the relative simplicity of tools which give primacy to SQL, and not objects,
here's an example of a Data Access Object (DAO) implemented with web4j.
The actual SQL statements are placed in .sql text files placed near the corresponding DAO
(usually in the same directory).