Thursday, January 30, 2014

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) 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.
JDK Requirement1.3+1.5+
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,, boolean[], byte[], char[], double[], float[], int[], long[], short[]java.lang.ObjectinterfaceBoolean[], 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 typesCollection/List/Map of reference (interface/Object) types, Collection/List/Map of persistable typesJava 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,, 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, entity graphs
Bulk update/deleteJDOQL Bulk DeleteJPQL Bulk Delete, JPQL Bulk Update
RDBMS Schema ControlTables, columns, PK columns, PK constraints, FK columns, FK constraintsindex columnsindex 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, Map
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 available in "JDO".


oakleyses said...

louis vuitton handbags, oakley sunglasses, louboutin, longchamp outlet, nike shoes, louis vuitton outlet stores, chanel handbags, burberry outlet, prada outlet, jordan shoes, tiffany and co, michael kors outlet, tory burch outlet, louis vuitton outlet, longchamp handbags, nike free, true religion jeans, michael kors outlet, kate spade outlet, polo ralph lauren outlet, tiffany and co, prada handbags, polo ralph lauren outlet, michael kors outlet, michael kors outlet, longchamp handbags, oakley sunglasses, ray ban sunglasses, kate spade handbags, burberry outlet, louis vuitton outlet, louboutin outlet, louboutin, coach factory outlet, air max, air max, coach outlet, gucci outlet, christian louboutin shoes, michael kors outlet, coach purses, ray ban sunglasses, michael kors outlet, louis vuitton, coach outlet store online, true religion jeans, oakley sunglasses cheap

oakleyses said...

ralph lauren, lululemon, air max, hollister, north face, nike air max, polo lacoste, vanessa bruno, timberland, vans pas cher, louboutin, louis vuitton, oakley pas cher, air max pas cher, nike roshe run, air max, true religion outlet, barbour, sac longchamp, air force, hollister, sac louis vuitton, nike free, polo ralph lauren, nike trainers, louis vuitton uk, nike roshe, sac hermes, longchamp, michael kors, sac burberry, sac guess, mulberry, new balance pas cher, converse pas cher, sac louis vuitton, hogan outlet, nike tn, north face, true religion outlet, ray ban pas cher, michael kors, air jordan, nike blazer, nike free pas cher, michael kors pas cher, abercrombie and fitch, ray ban sunglasses

oakleyses said...

mac cosmetics, mont blanc, marc jacobs, canada goose outlet, nike huarache, vans shoes, soccer jerseys, hollister, giuseppe zanotti, beats by dre, abercrombie and fitch, longchamp, insanity workout, celine handbags, bottega veneta, ghd, nfl jerseys, north face outlet, chi flat iron, ugg boots, birkin bag, ugg australia, canada goose, herve leger, ugg pas cher, rolex watches, valentino shoes, canada goose uk, canada goose, ferragamo shoes, canada goose, ugg boots, uggs outlet, north face jackets, soccer shoes, asics running shoes, new balance shoes, p90x, lululemon outlet, canada goose jackets, mcm handbags, instyler, babyliss pro, ugg, wedding dresses, jimmy choo outlet, reebok outlet, nike roshe run

oakleyses said...

parajumpers, karen millen, air max, converse, pandora charms, moncler, louboutin, moncler, links of london, lancel, juicy couture outlet, oakley, hollister, pandora charms, supra shoes, thomas sabo, canada goose, gucci, wedding dresses, timberland boots, swarovski crystal, air max, coach outlet store online, moncler, ray ban, canada goose, moncler, ugg, louis vuitton, swarovski, hollister, montre homme, moncler, hollister clothing store, ralph lauren, rolex watches, moncler outlet, moncler, iphone 6 cases, baseball bats, juicy couture outlet, toms shoes, vans, pandora jewelry, ugg, converse shoes

Inma Maulana said...

If you have a history of illness that is difficult to recover, maybe our next article will help you to recover

Cara menghilangkan sakit saat buang air kecil
Cara menghilangkan gatal akibat kutu air
Cara mengempiskan & menghilangkan benjolan
Obat Herbal Untuk Batuk Berdarah
Cara Menghilangkan Kebas & Kesemutan
Pengobatan Alami Untuk Penyakit Ginjal
Biaya Operasi Untuk Pengangkatan Tumor
Obat Tipes Alami