Java Data Object (JDO) in JDBC
Introduction to JDO
- Java Data Object (JDO) is a specification of transparent persistence (ability to directly manipulate data, which is stored in database) for Java Object Model.
- JDO is a standardized persistence API (Application Programming Interface).
Benefits of JDO
The concept of JDO was built with an aim to:
1. Save the developer's time and make it easy to use
Application developers focus on their domain object model and not on the details of persistence to the JDO implementation. If developers create persistence of data using JDBC, it is necessary to write and test the code. So, it can be a time consuming process. JDO can save these efforts of the developer.
2. Maintain portability
Applications written in JDO API are portable, which can be used for multiple implementation without changing the source code.
3. Use data independently
JDO can be used in Java environment, which is independent of relational or object database environment.
Primary Components of JDO architecture
Some basic components of JDO are as stated below:
1. JDO Helper: JDO utility provides a standard utility, which is used to access across the important part of JDO persistence process. This utility is called as JDO helper.
2. Persistence Manager: Each persistence manager manages its own transaction and application cache. There are one or more persistence managers available in JDO architecture and it is managed by persistence manager factory.
3. JDO query: JDO query consists of three important elements like class of candidate instance, collection of JDO instance and query filter. Query can be executed on the basis of the given parameter.
JDO Transactions
JDO transaction has one-to-one relationship with persistence manager.
Methods in transaction class are as follows: