Mapping Data to Models
Mapping Data to Models: Mapping Data to Models: an overview, Model Review, Mapping Data to Models, Data Access Objects, Example.
Updated
- Mapping Data to Models: an overview (Journeyman): Storing query results in model objects lets your program reuse the data without querying the database again.
- Model Review (Journeyman): A Category model class has a private field, a getter and a setter for each column of the categories table.
- Mapping Data to Models (Journeyman): Turn each row of a query result into a Category object and collect them in an ArrayList.
- Data Access Objects (Journeyman): A data access object (DAO) is a class that holds the database code for one table, so the rest of your program calls methods like getAllCategories() instead of writing SQL.
- Example (Journeyman): A CategoriesDao class loads every category from the database into a list, and Main prints each category's name.