logo

Data Persistence

   

Added on  2023-06-08

17 Pages3328 Words342 Views
 | 
 | 
 | 
Running Head: DATA PERSISTENCE
0
Data Persistence
Data Persistence_1

DATA PERSISTENCE
1
Contents
Introduction...........................................................................................................................................2
Java Serialization...................................................................................................................................2
Advantage of data serialization.........................................................................................................6
Disadvantage of data serialization.....................................................................................................6
Java Database Connectivity (JDBC)........................................................................................................6
Advantage of JDBC.............................................................................................................................7
Disadvantage of JDBC........................................................................................................................8
Java Data Object (JDO)..........................................................................................................................8
Java Persistence APIs (JPA)..................................................................................................................10
Conclusion...........................................................................................................................................14
References...........................................................................................................................................15
Data Persistence_2

DATA PERSISTENCE
2
Introduction
Data persistence is a type of data which is used in data processing to denote information
of any data and it is infrequently accessed. In computer system persistence data is
defined as a data which outlives the method that produced it. There are many methods
through which data persistence in java can create such as serialization, JCA, JDBC, and
JPA. It is estimated that many data is persistence in any database and a relational
database is the best example of data persistence. Java data persistence involves
numbers, date, byte, bit, strings, arrays, image, and any Java object (Ang, and Wen,
2005). There are many applications of Java database that uses data persistence in their
model framework. There are many reasons to use data persistence in any database such
as it improves the productivity of database model, independent database, through this
database parameter of java can be handled, and it also avoids unnecessary queries. Java
is defined as an object-oriented language which is used to store data objects and it uses
data persistence process to persisting data in any model (Barmpis, and Kolovos, 2012).
This report is explaining about data persistence, use of data persistence in Java, and
different type of data persistence such as Java serialization, JDBC, JDO, and JPA. The
main objective of this report is to understand the role of data persistence in java and
evaluating various types of data persistence.
Java Serialization
Serialization in Java is defined as a process which is used to convert the state of any
object into a byte stream. Deserialization is inversely proportional to the serialization
process in which byte stream is converted into java object. Serialization is also used to
persistence data in the java language (Birk, Chao, and Chung, 2006). The byte stream
process produced an independent platform and serialization us one of the processes
which provide object serialization in java programming. To produce java object through
the serialization process we used the java.io.serializable method. There are some points
to remember when serialization method is used in java such as-
If any parent class has evaluated through serialization process then child class
does not require implementing.
In serialization process only non-static information or data are used.
Data Persistence_3

DATA PERSISTENCE
3
Related objects must be evaluated through the serialization process.
Transient data and static data are not saved through the serialization method.
Figure: Java Serialization process
(Source: Geeks for Geeks, 2018)
Example: Java code for serialization and deserialization
// of a Java object
import java.io.*;
class Emp implements Serializable {
private static final long serialversionUID =
129348938L;
transient int a;
static int b;
String name;
int age;
// Default constructor
public Emp(String name, int age, int a, int b)
{
this.name = name;
this.age = age;
this.a = a;
this.b = b;
Data Persistence_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents