Data Persistence in Java: A Comprehensive Analysis

Verified

Added on  2025/06/23

|19
|2783
|70
AI Summary
Desklib provides solved assignments and past papers to help students succeed.
Document Page
RESEARCH REPORT ON JAVA DATA
PERSISTENCE TECHNOLOGY
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Table of Contents
Introduction......................................................................................................................................3
Java Serialization.............................................................................................................................4
Java Database Connectivity (JDBC)...............................................................................................6
Java Data Object (JDO)...................................................................................................................9
Java Persistence APIs (JPA)..........................................................................................................12
Conclusion.....................................................................................................................................18
References......................................................................................................................................19
List of Figure
Figure 1: JDBC Layers....................................................................................................................6
Figure 2: JDBC in the Java persistence layer..................................................................................7
Figure 3: Architecture of Java Data Object (JDO)..........................................................................9
Figure 4: Class-Level Architecture................................................................................................12
Figure 5: JPA and the ORM layer.................................................................................................16
Document Page
Introduction
Data Persistence is an important term to consider when it comes to storing a large amount of
data. The Data persistence deal with the data remains unaffected even after the process is out of
scope which is responsible for the creation of that data. The word persistence describes the object
of a thing remain unchanged or abele to survive after the creator is removed. The method or
technique of persistence is useful when the data is lost or the system goes down or when the
unauthorized changes are performed on the data. There are different type of persistence methods
which provide persistence to the stored data and the easiest way is with Periodic Snapshot at
periodic Interval. There are lots of organization stores their data on the database which contain
data related to their employees, production and other information related to the organization.
According to Romero and Vernadat (2016), an Enterprise Information Systems is used by many
organization for storing data and the data is managed according to requirements. This system is
capable to provide service for storing the useful data, manage them and represent in a different
form depending upon the viewer whether it is an accountant, financial officer, higher authorities,
etc. This system needs the data to be in persistence form so that the data safety is maintained.
There many large organizations which use the Enterprise Information Systems for a long period
of time so that the data used for multiple purposes and can be easily accessible. These stored data
must be prevented from loss and must be unaffected by other threats. Due to the reason of data
loss and other issues, the persistence of the stored data is implemented so that the big loss can be
reduced. There are some situations where the stored data is integrated from the different form
and for making them compatible, the changes are performed. The persistence method will
prevent the affection of these changes on the original data. Data Persistence methods are
implemented using Java. Java Persistence Technology provides a high level of persistence to the
stored data using object-oriented features (Daniel et. al., 2017). There are four options available
for data persistence which includes Java Serialization, Java Database Connectivity, Java Data
Object, and Java Persistence APIs. These technologies provide persistence of the data using java
language features and other concepts. The following report going to cover these four
technologies with their advantages and disadvantages. Based on the utility, suitable code is also
used.
Document Page
Java Serialization
The Serialization in Java is a process for storing the state of an object and the object is converted
into another representation. The default conversion is in the byte format. The process of
serialization persists the data so that the object can be restored whenever required. The data is
stored in the serial form which is used for recovery in the future (Cejka, Mosshammer and
Einfalt 2015). There are multiple objects created and destroyed after the application is closed.
The process of serialization provides support for those object which can be used in the future so
the objects remain undestroyed even after the application is closed and restarted. This makes it
possible to rebuild the object when that particular class is called.
For using Serialization, the class must implement the Serializable interface. Example of the
implementing serialization in java:
The following code shows the serialization of the object of class DateAndTimeObject this means
that the object can be accessed after the application is closed or the process is closed. The
io.Serializable package is imported for using the Serializable interface.
Advantages
The object can be persisted or their state can be saved for future changes.
The process can be used for providing persistence to the stored data.
The customization is possible and can be used easily.
The implementation of secure java computing by using different operations like
authentication, compression, and encryption.
The Evaluation of the object schema of an application is possible by these methods.
The interface is used for exchanging object between different libraries.
Disadvantages
The required format is difficult to maintain throughout the life of that particular data or
object.
There is less stability in the formatting of the data.
The changes in the Class will also affect the serialized data in different aspects.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
The initialization of the field is in alphabetical order rather than source order. So there is
no call of the constructor when the memory allocated.
The space occupied by the data is very big so compression is needed.
Addition of attributes or removal of attributes in the class declaration, unable the user to
reload objects.
The new technology is been introduce for java language for removing the problem face by
Serialization.
Document Page
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC) is a feature of java application or programing which provide
an easy and effective connection between the different level of data such as Relational Database,
or other external Database. Java Database Connectivity (JDBC) is an API which is responsible
for the query execution and the connection with the database. There is two-layer in the JDBC
which is: JDBC API (used for communication between Application and JDBC manager) and
JDBC driver (used for communication between JDBC manager and Database Drivers).
Figure 1: JDBC Layers
JDBC drivers are the drivers used for establishing a connection between the database and other
nodes. JDBC consist of different interfaces and classes to provide data persistence and process
the information stored in the database.
Document Page
Figure 2: JDBC in the Java persistence layer
Example –
Query -
The above code provides connectivity with the database. There are two things to do first the table
is created in the database. Then java code is used for connecting the object to the database.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Advantages
The stored data can be used by the users or other authorities doesn’t matter if it is stored
on a different database.
The Development of application is easy by using the JDBC API and it also less
expensive.
There is less or no configuration requirements on both sides server-side and client-side.
There is an object for establishing the connection.
There is a much-sophisticated application, which used the metadata by using JDBC.
The JDBC makes the application and its code easier to maintain while the portability is
also considered.
There is no requirement of content conversion. The JDBC automatically perform
structure formation for the database.
Disadvantages
Each type of database requires correct and compatible drivers so that the database can be
access accurately.
There is difficulty in inserting multiple tables in a particular sequence.
The changes in the database required changes in the whole statements of the SQL which
will result in an increase in the complexity.
Not good for large projects as it requires installation of drivers for each database.
As there are lots of issues related to the JDBC. Using Java Data Object (JDO) and Java
Persistence APIs (JPA) where the flexibility is a concern. The data is stored for a long time
which also requires proper management.
Document Page
Java Data Object (JDO)
Object database
The object database is a type of database for storing the data on the basis of object-oriented
concepts. The data are stored in the form of objects rather than the tables. The reference
attributes are used in the Object Database whit the allowance of both single and multiple or
collected references. This type of data stores the complex data with complex linking between
these data. This database technique allows the code to handle all the complex data at one place
(Alagić, 2017).
The architecture of Java Data Object (JDO)
The Java Data Object (JDO) a method for improving Persistency of the data store in the
database. The JDO enable to transparent the persistence of the data and provide access for the
data without making any SQL statement explicitly. The JDBC have more control on the database
then the JDO but JDO is supported easy and effective access to the program. There are some
main functionalities of JDO which includes transparent persistence, managing the objects cache
and queries which is generated with the system or application (Wu, Shen, Deng and Cheng,
2019).
Figure 3: Architecture of Java Data Object (JDO)
JDOHelper – Contain helper methods which can be used for queries for a persistent object.
PersistenceManagerFactory – It is the factory for PersistenceManagers.
Document Page
PersistenceManager – The PersistenceManager manages all the interfaces and other function of
the application. It is responsible for the management of the persistence object.
PersistenceCapable – Calling of the Persistence class is followed by this part of JDO. The
special type of persistence interface is provided by this part.
Transaction – The transaction part includes all the transaction or information exchange between
the persistent objects of the classes.
Extent – This part provides the logical view of the classes and their objects present in the data
store.
Query – The query part included the query generation which is used for finding the required
persistent object.
FetchPlan – This part of the JDO gives control over the different operations like fetching, data
loading, etc.
Sequence – The sequential value is generated by the objects present in the persistence classes.
These sequences are used for mapping of data or metadata.
DataStoreCache – This is the type of cache memory generated by the JDO during the execution
of the application.
Example –
The following code shows the retrieval of the PersistenceManager using
PersistenceManagerFactory interface
Features
The productivity is improved for the developer and for features can be added to the
application or the upadation can be easily performed on code.
Both new data, as well as old, can persist in the java language so that the data can be used
in the future.
The JDO also supports Dynamic Queries and schema creation.
JDO replace all the complexity of the SQL statements.
Multiple object relationship can be accessed by the JDO in the database.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
JDO provides support for Persistence Capable classes which provide the capability of
providing persistence to the stored data or object which access the data.
There is a negotiation between different queries and other transactions between
applications.
Limitation
There is difficulty in handling of Parameters and type when the code is generated using
JDO.
There is no such support for hibernation and the linking between the applications is not
so fast.
There can be unnecessary queries which can be generated during the process of
implementation.
Document Page
Java Persistence APIs (JPA)
Object-relational mapping (ORM)
Object-relational mapping (ORM) is a technique used for connecting the object code with the
relational database (Torres, Galante Pimenta, and Martins, 2017). The technique provides
conversion of the data between different systems. The complete process is based on the concept
of object-oriented. In scalar, objects are included in the following method. Encapsulation is also
provided using the data hiding technique. The Application creations are easy by using ORM as
the mapping process helps in managing all the data.
The software architecture of JPA
Java Persistence APIs (JPA) mainly focuses on the persistence of the object in the java code and
also JPA decide the object going to be persisted. The hibernation is used for implementing JPA
and this feature is used in place of SQL, NoSQL, etc. The JPA supports providing persisting to
the data or object used for APIs. For accessing the data, Java Persistence APIs is a standard API
used within the application.
Figure 4: Class-Level Architecture
EntityManagerFactory – This class provide support for the instances of the EntityManager and
also create the instances.
EntityManager – This part of the architecture deals with the persistence operation and
managing them as per the requirements. It is a type of instance.
chevron_up_icon
1 out of 19
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]