JDO .v. JPA : API

The two persistence standards in Java have very similar API's on the face of it. Here we give a comparison of the method calls and their equivalent in the other API.

OperationJDO2JPA1
Persist Objectpm.makePersistent()em.persist
Update Objectpm.makePersistent()em.merge()
Remove Objectpm.deletePersistent()em.remove()
Retrieve Objectpm.getObjectById()

pm.getExtent()
em.find()
Refresh Objectpm.refresh()em.refresh()
Detach single Objectpm.detachCopy()em.detach() (JPA2)
Flush changespm.flush()em.flush()
Access transactionpm.currentTransaction()em.getTransaction()
New Querypm.newQuery()em.createQuery()
New Named Querypm.newNamedQuery()em.createNamedQuery()
New SQL Querypm.newQuery()em.createNativeQuery()