Modified: websites/production/db/content/jdo/jdo_v_jpa.html ============================================================================== --- websites/production/db/content/jdo/jdo_v_jpa.html (original) +++ websites/production/db/content/jdo/jdo_v_jpa.html Tue Jan 15 06:29:01 2013 @@ -1,36 +1,423 @@ -Java Data Objects (JDO) - JDO .v. JPA

Which Persistence Specification ?

+ + + + + + Maven - + JDO .v. JPA + + + + + + + +

+ +
+ +
+
+
+ + +

Which Persistence Specification ?

+

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) + 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 + 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, and JPA2 providing criteria queries. 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. -

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureJDOJPA
JDK Requirement1.3+1.5+
UsageJ2EE, J2SEJ2EE, J2SE
Persistence specification mechanismXML, Annotations, APIXML, Annotations
Datastore supportedAnyRDBMS only
Restrictions on persisted classesno-arg constructor (could be added by compiler/enhancer)No final classes. No final methods. Non-private no-arg constructor. Identity Field. - Version Field.
Ability to persist "transient" fieldsYesNo
Persist static/final fieldsNoNot specified
TransactionsPessimistic, OptimisticOptimistic, some locking
Object Identitydatastore-identity, application-identityapplication-identity
Object Identity generationSequence, Table, Identity, Auto, UUID String, UUID HexSequence, Table, Identity, Auto
Change objects identityThrow exception when not allowedUndefined !!
Supported typesJava primitive types, wrappers of primitive types, java.lang.String, java.lang.Number, java.math.BigInteger, java.math.BigDecimal, - java.util.Currency, java.util.Locale, java.util.Date, java.sql.Time, java.sql.Date, java.sql.Timestamp, java.io.Serializable, - boolean[], byte[], char[], double[], float[], int[], long[], short[], - java.lang.Object, interface, - Boolean[], Byte[], Character[], Double[], Float[], Integer[], Long[], Short[], BigDecimal[], BigInteger[], String[], - PersistenceCapable[], interface[], Object[], Enums, +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureJDOJPA
JDK Requirement1.3+1.5+
UsageJ2EE, J2SEJ2EE, J2SE
Persistence specification mechanismXML, Annotations, APIXML, Annotations
Datastore supportedAnyRDBMS only
Restrictions on persisted classesno-arg constructor (could be added by compiler/enhancer)No final classes. No final methods. Non-private no-arg constructor. Identity Field. + Version Field.
Ability to persist "transient" fieldsYesNo
Persist static/final fieldsNoNot specified
TransactionsPessimistic, OptimisticOptimistic, some locking
Object Identitydatastore-identity, application-identityapplication-identity
Object Identity generationSequence, Table, Identity, Auto, UUID String, UUID HexSequence, Table, Identity, Auto
Change objects identityThrow exception when not allowedUndefined !!
Supported typesJava primitive types, wrappers of primitive types, java.lang.String, java.lang.Number, java.math.BigInteger, java.math.BigDecimal, + java.util.Currency, java.util.Locale, java.util.Date, java.sql.Time, java.sql.Date, java.sql.Timestamp, java.io.Serializable, + boolean[], byte[], char[], double[], float[], int[], long[], short[], + java.lang.Object, interface, + Boolean[], Byte[], Character[], Double[], Float[], Integer[], Long[], Short[], BigDecimal[], BigInteger[], String[], + PersistenceCapable[], interface[], Object[], Enums, java.util.Collection, java.util.Set, java.util.List, java.util.Map, - Collection/List/Map of simple types, Collection/List/Map of reference (interface/Object) types, + Collection/List/Map of simple types, Collection/List/Map of reference (interface/Object) types, Collection/List/Map of persistable types - Java primitive types, wrappers of the primitive types, java.lang.String, java.math.BigInteger, java.math.BigDecimal, - java.util.Date, java.util.Calendar, java.sql.Date, java.sql.Time, java.sql.Timestamp, java.io.Serializable, + Java primitive types, wrappers of the primitive types, java.lang.String, java.math.BigInteger, java.math.BigDecimal, + java.util.Date, java.util.Calendar, java.sql.Date, java.sql.Time, java.sql.Timestamp, java.io.Serializable, byte[], Byte[], char[], Character[], Enums, java.util.Collection, java.util.Set, java.util.List, java.util.Map - Collection/List/Map of persistable types
Embedded FieldsEmbedded persistent objects, Embedded Collections, Embedded MapsEmbedded persistent objects
Access a non-detached fieldThrow exceptionUndefined !!
InheritanceEach class has its own strategyRoot class defines the strategy
Operation cascade defaultpersist, (delete)
Operation Cascade configurationdeletepersist, delete, refresh
Query LanguageJDOQL, SQL, othersJPQL, SQL
Query candidatesCandidate without subclasses, Candidate and its subclassesCandidate and its subclasses
Query of candidate collectionyesno
Query language case sensitivityJDOQL lowercase/UPPERCASEJPQL case-insensitive
Query language aliasesNo, but has variables in JDOQLYes in JPQL
Query Criteria APINo, available as extension in QueryDSLYes
Object retrieval controlLazy/Eager control, fetch groupsLazy/Eager control
Bulk update/deleteJDOQL Bulk DeleteJPQL Bulk Delete, JPQL Bulk Update
RDBMS Schema ControlTables, columns, PK columns, PK constraints, FK columns, FK constraints, index columns, - index constraints, unique key columns, unique key constraintsTables, columns, PK columns, FK columns, unique key columns
ORM RelationshipsFull range of Collection, Map, List, Array, 1-1, 1-N, M-N using - PC, Non-PC and interface objectsBasic 1-1, 1-N, M-N, Collection<NonPC>, Map<NonPC>
Default ORM column size256255
Default ORM identifiers (tables/columns)NoYes
Default ORM mappingsYes, JDBC types defined for Java typesNo
Caching interfaceL2 Caching APIL2 Caching API

- As an overall conclusion "JPA" is a subset of what is already available in "JDO". -


\ No newline at end of file + Collection/List/Map of persistable types
Embedded FieldsEmbedded persistent objects, Embedded Collections, Embedded MapsEmbedded persistent objects
Access a non-detached fieldThrow exceptionUndefined !!
InheritanceEach class has its own strategyRoot class defines the strategy
Operation cascade defaultpersist, (delete)
Operation Cascade configurationdeletepersist, delete, refresh
Query LanguageJDOQL, SQL, othersJPQL, SQL
Query candidatesCandidate without subclasses, Candidate and its subclassesCandidate and its subclasses
Query of candidate collectionyesno
Query language case sensitivityJDOQL lowercase/UPPERCASEJPQL case-insensitive
Query language aliasesNo, but has variables in JDOQLYes in JPQL
Query Criteria APINo, available as extension in QueryDSLYes
Object retrieval controlLazy/Eager control, fetch groupsLazy/Eager control
Bulk update/deleteJDOQL Bulk DeleteJPQL Bulk Delete, JPQL Bulk Update
RDBMS Schema ControlTables, columns, PK columns, PK constraints, FK columns, FK constraints, index columns, + index constraints, unique key columns, unique key constraintsTables, columns, PK columns, FK columns, unique key columns
ORM RelationshipsFull range of Collection, Map, List, Array, 1-1, 1-N, M-N using + PC, Non-PC and interface objectsBasic 1-1, 1-N, M-N, Collection<NonPC>, Map<NonPC>
Default ORM column size256255
Default ORM identifiers (tables/columns)NoYes
Default ORM mappingsYes, JDBC types defined for Java typesNo
Caching interfaceL2 Caching APIL2 Caching API
+

+ As an overall conclusion "JPA" is a subset of what is already available in "JDO". +

+
+ + + +
+
+
+
+
+ + + Modified: websites/production/db/content/jdo/jdo_v_jpa_api.html ============================================================================== --- websites/production/db/content/jdo/jdo_v_jpa_api.html (original) +++ websites/production/db/content/jdo/jdo_v_jpa_api.html Tue Jan 15 06:29:01 2013 @@ -1,11 +1,297 @@ -Java Data Objects (JDO) - JDO .v. JPA : API

JDO .v. JPA : API

+ + + + + + Maven - + JDO .v. JPA : API + + + + + + + +

+ +
+ +
+
+
+ + +

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. -

OperationJDOJPA
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()
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()

\ No newline at end of file +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OperationJDOJPA
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()
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()
+
+ + + +
+
+
+
+
+ + +