While SQL & Hibernate are mostly portable, one crucial area remains subject to incompatibility. Primary keying is the foundation of our tables, but key allocation is non-standard.
Most other SQL elements are standard & compatible, especially with the help of Hibernate. Joins, columns, mappings & queries will generally port without a hitch.
But when we get to identifier generation, the picture falls apart. Some databases use auto-increment/ identity columns, others sequences. Syntaxes differ, retrieving generated keys is variable at best. With such divergence, how can we possibly allocate keys portably? Continue reading