/JDO ”Write Once, Persist Everywhere”

JDO ”Write Once, Persist Everywhere”

JDO “Java Data Objects” :- It’s Java API “application program interface” for transparent persistence, support transactions and multiple users, allows developer to persist Java objects, allows Java developers to use their object model as a data model {There’s no need for developer to spend his time between the data side and Object side}.
JDO allows you to store and retrieve objects in an easy way for Java programmers, instead of working with JDBC or EJB’s persistence, you can work directly with your Java objects.
So that .. you don’t have to copy data to and from database tables or SELECT to perform queries, your JDO implementation perform all processes on persistence and you can make queries based on the fields of your Java objects, using the normal Java syntax.

JDO {unlike JDBC} :
allows multiple users and transactions, So that .. there’s no need to think about SQL and database stuff.
JDO : technology allows you to directly store your Java domain model instances into the persistent store “database”.
JDO : provided by Sun Java Community.
JDO : works with object Databases and Relational Database.
JDO : works also with J2EE “Java Enterprise Edition” and EJB “Enterprise JavaBeans”.
Why we use JDO for Application Programming !?

  1. Database independence :- JDO applications and implementations are independent of the database and support many different types of transactional data stores as : relational and object databases, XML, flat files, …
  2. Easy to use :- JDO programmers can ignore the details of persistence.
  3. Portability :- JDO apps. can run on many platforms and many implementations with no need for re-compiling or change of source code.
  4. JDO Can take all features of EJP “Enterprise JavaBeans” as :-
    • Remote message processing.
    • Automatic distributed transaction .
    • Security.
  5. High performance.

 

JDO Architecture

 ** high-level JDO API :– is designed to provide an interface for JAVA developers to store data, without learning each new data access language “as SQL” for each type of persistent data storage.
 ** low-level JDO API “as JDBC” :- used to store data, it enables JAVA developers to write Java code that accesses the underlying data store, without using specific code for the database.

  • JDO

The main tasks of JDO architecture :-

  1. To provide transparent Java technology for Java application developers.
  2. To enable implementations of data stores into application servers.

Note that :-
JDO doesn’t mean to replace JDBC. They complete each other , each one has unique strengths, and different developers with different skill and different targets can use both.
For example:-

  • ** JDBC offer greater flexibility by giving Java developers direct control over database access.
  • ** JDO offers more facility for developers by hiding SQL, this allows Java developers to focus on the DOM “Document Object Model” without need for knowing or learning SQL.

 
JDO instance :– is a Java class instance that implements the application functions and represents data in an enterprise data store, its class always implement the {Persistence Capable} interface.
As a result, your code becomes easier to maintain, easier to re-use, and easier to test.

  •  The developer doesn’t restricted to‫ ‏‬a specific database, there’s no need for the developer to know whether the data store is a relational database, an object database, or just a set of files.

 
jdo
Finally .. We can briefly present the main goals of JDO :-

  •  —  JDO simplify the transaction implementations of database systems.
  •  — JDO provide a transparent interface from application to database, So that the developer doesn’t have to learn SQL or any other data access language.
  • — JDO make it easy for developers to use the Java model to design the application, and transparently store and retrieve data from different database systems.
  • — JDO make it easy for the developer to connect to different database