HiLo vs Identity?

This is the same question as: HiLo or personality?

Take the database of this site as an example.

Suppose a site has the following tables:

  • Messages
  • Votes.
  • Comments

Which strategy is best for him:

Identity - which is more common.

OR

HiLo - which give the best performance.

Edit: if HiLo is the best, what will the database structure look like?

+4
source share
2 answers

Not only does HiLo provide the best performance almost always, but it also maintains the Unit of Work, avoiding ALL recordings until the session begins.

Being โ€œmore commonโ€ (?) Does not seem to be an objective technical advantage.

I recommend that you read the http://fabiomaulo.blogspot.com/2009/02/nh210-generators-behavior-explained.html detailed explanation of the shortcomings of personality choice.

+7
source

I have some code examples on how to use MultipleHiLoPerTableGenerator with Hibernate annotation.

Refer to the bottom of this blog:

http://shengchien.blogspot.com/2010/10/hibernate-batch-processing-with-mysql.html

+1
source

Source: https://habr.com/ru/post/1304184/


All Articles