Java Persistence

Java Persistence

Before we dive into “Java Persistence” in complete elaboration, let’s first understand what the word Persistence means.

What is Persistence?

Persistence in computer programming means to store (persist) the state of a program so that it can be retrieved at any point of time, independent of the process which persisted it.

WikiPedia has the definition of Persistence as “persistence refers to the characteristic of state that outlives the process that created it. This is achieved in practice by storing the state as data in computer data storage”.

Persistence Example

Suppose you are playing a game which has got multiple levels, let’s say 10. You started playing and continued with it until you get tired at Level 7. You want to take some rest. You go to the options and save the game.

Now, for some reason your playstation (or XBOX) got switched off. Will you be able to resume the game from Level 7 or you will have to start from Level 1? Ofcourse, it will resume from Level 7.

Your gaming software(persisting process) persisted the state of the game in the underlying database and re-instantiated the game after it got started.

Now, when you have understood what persistent means. It’s time to dive into what persistence means in the context of Java.

What is Java Persistence?

As you know, Java is an Object Oriented Programming Language. Everything including the state of a Java Program is in and through objects. You can call a Java application as different collection of objects interacting with each other.

Java Persistence - Sample Object Graph
Java Persistence – Sample Object Graph


Above image shows a Sample object graph representing the state of ‘University Software’. So, what should be the meaning of persisting the state of ‘University Software’ : Storing the sample object graph into some underlying mechanism (maybe MySQL Database), which is detached from ‘University Software’.

So, in the context of Java, persistence means to store the object graph of the Java application.

Hence, Java Persistence is the technique to store Java Objects into some underlying storage mechanism/technology which is detached from Java application itself.

Java Persistence in Layered Archiecture

Below image gives the typical layered architecture of a software application. Here, Persistence is done at Persistence Layer (also called DAO layer in Java community).

Java Persistence

Persistence Layer abstracts the business layer from underlying storage system.

List of different Java Persistence Technologies

Java provides different persistent technologies to deal with different software problems related to persistence.

  1. Serialization
  2. Java DataBase Connectivity (JDBC)
  3. Java Persistence API (JPA)
  4. Java Data Objects (JDO)
  5. Java Connector API (JCA)
  6. Service Data Objects (SDO)
  7. Enterprise Java Beans (EJB) – Entity Beans

List of different Java Persistence Frameworks

Based on (implementation of) one or more of the Java Persistence technologies above, there are a number of Java persistence frameworks available in the market:

  • ActiveJDBC
  • ActiveJPA
  • Apache Cayenne
  • Apache Gora
  • Athena Framework
  • Carbonado
  • DataNucleus(formerly known as JPOX)
  • Ebean
  • EclipseLink
  • Enterprise JavaBeans (EJB)
  • Enterprise Objects Framework part of Apple WebObjects
  • Fast Java Object Relation Mapping (Fjorm)
  • Speedment
  • Hibernate
  • Java Data Objects (JDO)
  • Java Object Oriented Querying (jOOQ)
  • Kodo
  • Kundera
  • MyBatis (formerly named iBATIS)
  • QuickDB ORM
  • TopLink
  • Torque

Waiting your comment, questions, suggestions in the comment section below.

Ankush Pahwa is an IT Majdoor (Labourer) in Indian IT industry for last 5 years. Don’t know what else to say, so stopping here.

Self-Learning -> Focused Group -> Learning Intensification -> Self-Learning

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

LinkedIn Auto Publish Powered By :