Primary key generation

While indicating Hibernate comments into substance classes or composing .hbm documents, we should abstain from utilizing the auto key age methodology, which prompts a gigantic measure of succession calls.

The following is an example code for defining the key generation strategy:

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "your_key_generator")
private Long id;

With this simple change, an improvement in the range of 10-20% can be noticed in insert-intensive applications, with basically no code changes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset