Java Persistence Layer: taking data from the user & saving it

Java Persistence LayerData storage is a very common and basic requirement of enterprise applications. Data storage ensures that the data collected from the user will be saved over time. The mechanism of saving data for the duration so as to make it available later is called persistency.

In Java, normally the persistency is of an object. Java can save an object state using the following ways:

 

Using object serialization

The process by which an object is saved across the network is serialization. In Java, an object is saved in the file. So we can even say, saving an object to the file is serialization.

 

Disadvantages of using object serialization

The disadvantages of object serialization are as follows:

 

Storing data in XML

In the past few years, XML has emerged as a favorite choice to handle data in a file using markups. The good thing is, the developer can use their own tags to represent the data collection.

 

Disadvantages of storing data in XML

The disadvantages of storing data in XML are as follows:

 

Saving the data in a relational database

An object consists of data members to present its state. The relational database consists of a table structure which has a row and column structure. One row in a table is mapped to one object. Mapping is a technique that places an object's data members in one or more fields of a database table. The relational database uses an easy query writing mechanism to deal with the stored data. Over the years, the relational database has become the choice of Java developers for achieving persistency.

 

Advantages of saving data in a relational database

The advantages of saving data in a relational database are as follows:

 

Вас заинтересует / Intresting for you:

Getting Started with Java prog...
Getting Started with Java prog... 1647 views Doctor Thu, 02 Aug 2018, 04:05:33
First Simple Java Program: ent...
First Simple Java Program: ent... 2083 views natalia Thu, 21 Jun 2018, 14:10:35
Creating and Manipulating Stri...
Creating and Manipulating Stri... 1852 views Максим Николенко Sun, 10 Jun 2018, 19:17:56
Why is Java a Good Choice for ...
Why is Java a Good Choice for ... 1505 views Денис Thu, 20 Sep 2018, 15:57:59
Print