From the course: Java Persistence API (JPA): 1 The Basics

What is persistence? - Java Tutorial

From the course: Java Persistence API (JPA): 1 The Basics

Start my 1-month free trial

What is persistence?

- [Instructor] Can you imagine how upset you'd be if you'd just deposited $10,000 in your bank account and when you check your balance, your bank didn't have a record of that $10,000 you'd just deposited. Well, thanks to persistence your bank does have a record of how much money you have have across transactions. Thank persistence that your money is safe. Before diving into this course, it's important to first understand persistence. Why it's necessary and how it's achieved in Java applications. Applications sit on top of data and are created to store, view and manipulate that data. If you are using an application with no data and just blank screens. You'd probably stop using that application, right? This shows the importance of data to an application. Persisting is to data, like drinking is to a can of soda. For the most part, data is meant to be persisted so that it can be used later. Just like a can of Coca-Cola is meant for drinking. What exactly is persistence? Persistence refers to information that continues to exist, even after the process or application that created it, is no longer running. Unlike data that is stored in memory and disappears after a program shuts down, data that is persisted exists across time. And can live independent of the system that created it. When I explain persistence versus in-memory. I use the example of writing a document in Word. Let's say you are authoring a document in Word, but haven't clicked the save button. The document is considered to be in-memory and it's only persisted, or saved, when you click the save button. If you never save the document, the information inside of it will be lost. Using the Word example, I hope that you can see the importance of persisting, or saving data. We persist data so that it can be later retrieved, processed, transformed and or analyzed. There are several storage options when it comes to persisting data. Relational databases, NoSQL schemaless databases, file systems, disk storage et cetera. In this course we will use a relational database. How is persistence achieved in Java applications? The Java Persistence API, JPA specification and its associated implementations, help Java developers with accessing, persisting and managing data between Java objects, classes, and relational databases. I've been a professional Java developer for let's just say a long while. And I'm glad that the JPA specification and its associated implementations are available to assist with the important task of persistence. The multiple implementations show that JPA is widely adopted in the industry.

Contents