Identifier generation by R4R Team

Identifier generation: In hibernate when we talk about the portability that mean it consider the database and another important decision is selecting the identifier generation stratagy want to use. Hibernate provide the different generation for this purpose, which intended to select between a sequence, identity, or table strategy depending on the capability of the underlying database. Because Hibernate relies on this identifier value to uniquely reference entities within a persistence context it must then issue the insert immediately when the users requests the entitiy be associated with the session (like via save() e.g.) regardless of current transactional semantics. An insidious implication of this approach come about when targtetting some databases which support identity generation and some which do not. it is what is known as a post-insert generation strategy because the insert must actually happen before we can know the identifier value.  identity generation relies on the SQL definition of an IDENTITY (or auto-increment) column to manage the identifier value. Hibernate was changed slightly once the implication of this was better understood so that the insert is delayed in cases where that is feasible. The underlying issue is that the actual semanctics of the application itself changes in these cases. Starting with version 3.2.3, Hibernate comes with a set of enhanced identifier generators targetting portability in a much different way.

Type of Enhance Generator: There is two type of Enhance generator those are given below:


The idea behind these generators is to port the actual semantics of the identifer value generation to the different databases. For example, the mimics the behavior of a sequence on databases which do not support sequences by using a table.
Leave a Comment:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!