Now, if you're a Java developer (like Yours Truly :) then you already know that there are many ways of doing persistence with our Java applications. For those who do not know it yet, there are many persistence technologies available for Java out there, and two of these persistence technologies are JPA (Java Persistence API) and JDO (Java Data Objects).
JDO And JPA, What's The Difference?
Java Data Objects (JDO) and Java Persistence API (JPA) are both standard-based interface for persisting Java objects in J2SE and J2EE applications. Both JPA and JDO technologies supports dynamic queries and POJOs (Plain Old Java Objects) and both are easy to unit test.
Now what's the difference?
I will only talk about the differences of the two technologies when it comes to JDK requirement, Transaction types, and supported Datastores:
- JPA requires JDK 1.5 and above (since JPA was introduced on Java 5).
- JDO requires JDK 1.3 and above. (y) :-)
- JPA supports Optimistic transactions only.
- JDO supports both Optimistic and Pessimistic transactions (y) :-)
- JPA supports Relational Databases (RDBMS) only.
- JDO supports any Datastores. (y) :-)
Conclusion: JPA (Java Persistence API) is a lightweight Java persistence technology and is a subset of features already available in JDO (Java Data Objects).
Now, which one to use? For me, I will use JPA as a replacement for Enterprise JavaBeans (EJB) Entity Beans. And that's it! Thank you and happy reading .",)
See also: JPA Entity Beans