
- Java
- Intermediate
About this Course
Most meaningful applications you will write will have a database associated with it. Knowing how to connect with and incorporate this data is critical to success as a Java developer. In this course, we'll cover how to connect a Java application to a database using what's called JDBC, or Java Database Connectivity. Then, we'll use the convenient approach of including an ORM, or Object Relational Mapper. This will allow us to interact with our data using object-oriented techniques instead of exclusively relying on hard-coded SQL. The ORM we will use is called Hibernate, and is one of the most popular ORMs available.
What you'll learn
- Using a database with Java
- Performing CRUD operations
- Connecting with JDBC
- Object-Relational Mapping (ORM)
- Wrapping a database with Hibernate
Data Persistence & ORMs
During this stage, we'll start by practicing the basic SQL CRUD operations in a SQL Playground. Then, we'll use workspaces to connect a Java application to a SQLite database using JDBC, or Java Database Connectivity. Finally, in an attempt to map Java objects to database tables, we'll build a case for incorporating the all-inclusive solution of an Object Relational Mapper such as Hibernate.
9 steps-
Course Introduction
1:52
-
Introduction to Data Persistence
3:18
-
Review of DB Concepts
3 questions
-
Review of SQL
7:19
-
SQL Review
5 questions
-
Using Java to Connect to a Database
13:55
-
Using JDBC to Connect to a Database
2 objectives
-
Save a Java Object to a Database
6:27
-
The Case for Object-Relational Mapping
2:43
Getting Started with Hibernate
After stretching our database and SQL muscles, we're now ready to incorporate an Object Relational Mapper, or ORM. In this stage, we'll configure our Java application to work with Hibernate. To instruct Hibernate as to how we wish to map our POJOs/entities to database tables and columns, we'll employ JPA annotations.
10 steps-
Intro to Hibernate
2:17
-
Hibernate Sessions
2 questions
-
Configuring a Project to Use Hibernate
6:34
-
Create a Hibernate Configuration File
2 objectives
-
Adding a POJO with JPA Annotations
9:34
-
Adding JPA Annotations to an Entity
2 objectives
-
Building a Hibernate SessionFactory
4:41
-
The Builder Design Pattern
8:46
-
The Builder Design Pattern
1 question
-
Using the Builder Pattern
1 objective
Persisting Data with Hibernate
Now that we have our application configured to use Hibernate, it's time to see how all the CRUD operations are performed using Hibernate. During this stage, we'll see how to write the code for actually creating, reading, updating and deleting entity objects with the Hibernate SessionFactory
.
Teacher
-
Chris Ramacciotti
I spent six years teaching introductory and advanced computer science to high school students in Omaha and Chicago, and have also worked as a full-time Java developer. As a teacher, I continually strive to support students in removing all perceived and actual barriers to learning highly sophisticated material.
I enjoy running and yoga, especially outdoors in the beautiful Chicago summer weather.