JDBC has a feature of group multiple queries in one single unit and pass it in a single network trip to the database.
As shown in this code example:
St