|
There are two standard API's for persistence - Java Data Objects (JDO) and Java Persistence
API (JPA). The former (JDO) is designed for all datastores, and the latter is designed for
RDBMS datastores only. When choosing the API to use in your application you should bear
the following factors in mind
-
Target datastore
: JDO is designed for all datastores, whereas JPA is just
designed around RDBMS and explicitly uses RDBMS/SQL terminology. If using RDBMS then
you have the choice. If using, for example, an ODBMS then JDO makes much more sense
-
Datastore interoperability
: are you likely to change your datastore type at
some point in the future ? If so you likely ought to use JDO due to its design
-
API
: both APIs are very similar. JDO provides more options and control
though for basic persistence and retrieval there are differences only in the namings
-
ORM
: JDO has a more complete ORM definition, as shown on
Apache JDO ORM Guide
-
Experience
: do your developers know a particular API already ? As mentioned
the API's themselves are very similar, though the metadata definition is different. Remember
that you can use JPA metadata with the JDO API.
-
Querying
: do you need a flexible query language that is object-oriented
and extensible ? JDOQL provides this and the implementation in DataNucleus allows
extensions. If you just want SQL then you can use JDO or JPA since both provide this
-
Fetch Control
: do you need full control of what is fetched, and when ?
JDO provides fetch groups, whereas JPA doesn't. Use JDO if this is an important factor
for your design
There is a
further comparison of JDO and JPA
on technical grounds over at Apache JDO.
|
|