# Objects from a Database: an overview

Most Java applications work with data from a database, so many of their classes model a table, with one object for each row.

Journeyman · Java · OOP · Updated November 16, 2026

By Gregor Dzierzon

Most Java applications are data-driven. This means that the information they display to the user comes from a database, or information that they get from a user will be saved to a database. In either case, the application needs to interact with a database. Because we use databases so frequently, many of the objects we need to define in Java are objects that come from a database.

Think of the tables in the Northwind database. The categories table has at least 8 rows. Each row represents 1 category. In Java, we would create a category object, then we would convert each database row into a Java object.

Notice that the categories table diagram closely resembles the UML Category class diagram.

![The categories table beside the UML Category class: each column (category_id, category_name, description) becomes a private variable (categoryId, categoryName, description) with a getter and a setter](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/09/08fe231010084d619694b0b664c29417.png)

## Cheat sheets

- [Objects from a Database: Creating Data Models](https://www.ask-codey.com/cheat-sheets/objects-from-a-database-an-overview-cheat-sheet)

Source: https://www.ask-codey.com/lessons/objects-from-a-database-an-overview
