Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About the hilo generator and the Configuration and SessionFactory class

 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I have two questions:

Question 1: The hilo generator generates unique number but no in the sequence.

So can I use the same hilo generator for more than one table? If I can use it for more than one table can there be duplicates in two

tables?

Further if I use the hilo genarator for a single table to insert around 20000 or more records every time it will generate a new number

that means it will scan the entire table for every generated value so its a performance hit. So what can be the scenarios when I will

prefer hilo generator.

Question 2: I want to know what Configuration and SessionFactory does exactly?

Which one is heavy weight is it Configuration or is it SessionFactory ?

Thanks
 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please reply
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Further if I use the hilo genarator for a single table to insert around 20000 or more records every time it will generate a new number

that means it will scan the entire table for every generated value so its a performance hit. So what can be the scenarios when I will

prefer hilo generator.

What makes you think the hilo pattern requires a full table scan?
 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because hilo generator generates the usique id but not sequencially.

So if I have 1000 or more records in the table then if I try to insert into the table using hibernates hilo

generator then how come hiberate knows that the id generated is unique.

I thought hilo generator generates an id and then checks the database for its uniqueness and then inserts a value.
Correct me if I am wrong and this is the reason i think it will be a perfomance hit.

Thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hilo pattern implementations usually use a high key table so don't need to check uniqueness (assuming all processes that insert into a table also use the hilo pattern).
 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hilo pattern implementations usually use a high key table so don't need to check uniqueness (assuming all processes that insert into a table also use the hilo pattern).

Not getting
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic