Compilation of already published Articles/Ideas/Problems-Solutions which I faced or came across over the period of time. Largely a place for me to document it as note-to-self. Nothing serious. :)

Thursday, January 30, 2014

Which Persistence Specification ?

http://db.apache.org/jdo/jdo_v_jpa.html

There are several competing persistence technologies available for Java. Two of these are "standardised" (via the JCP). When developing your application you need to choose the most appropriate technology for your needs. Java Data Objects (JDO) has been a standard since 2001 with the release of JDO1. It was improved with the release of JDO2. Just to confuse issues the Java Persistence API (JPA) was approved in its JPA1 form, and JDO2.1/JDO2.2 provide updates to JDO2 building on some of the new features of JPA1. Since then we have had JDO3 adding on extra metadata and enhancer standardisation, JPA2 providing criteria queries and JPA2.1 adding some further features. Below we show some of the differences of these 2 standards to give you assistance in selecting what you need. Highlighted in bold are the notable differences where one specification provides something not available in the other.

Feature

JDO

JPA

JDK Requirement

1.3+

1.5+

Usage

J2EE, J2SE

J2EE, J2SE

Persistence specification mechanism

XML, Annotations, API

XML, Annotations

Datastore supported

Any

RDBMS only

Restrictions on persisted classes

no-arg constructor (could be added by compiler/enhancer)

No final classes. No final methods. Non-private no-arg constructor. Identity Field. Version Field.