There aren't many steps... it's pretty simple... I'll try to address your
questions.

I did not understood this part "Don’t use this generator with a user-

supplied connection".

Anybody know what he meant with this?


ISessionFactory.OpenSession has overloads that take an IDbConnection.
If you use them, you can't use HiLo, because it needs the SessionFactory to
be managing connections.
It's an implementation detail, but basically, the hi values are retrieved in
a separate transaction, as they are SessionFactory-wide and indepentent of
the Session-initiated transaction.

I tried the hilo and it generates a table with the name

"hibernate_unique_key" and one

column "next_hi"


Those are actually configurable. It might help thinking of that table with a
single column and record as a replacement for sequences in databases that
don't support them. When you use seqhilo, all you have is a sequence name.

It also generates high values for ID's like 32772

I would like to understand this in depth, what are they for?


The HiLo algorithm is pretty straightforward.
Each identifier is composed by two parts, a Hi value that comes from the DB,
and a Lo value that is generated locally (an incrementing counter)
The Id is generating by combining those two parts, based on the max_lo
parameter, which specifies how many values you can generate for each Hi
value retrieved from the DB.
The default max_lo is 32767, which means the lower 15 bits would be used for
Lo values (that's why a value like 32772 is generated in the first
transaction).
Whenever the counter reaches max_lo, it fetches a new Hi value from the DB.

For the implications of the HiLo behavior, I recommend this post by Fabio:
http://fabiomaulo.blogspot.com/2009/02/nh210-generators-behavior-explained.html

   Diego


On Wed, Mar 31, 2010 at 10:10, Visar Uruqi <visar.ur...@gmail.com> wrote:

> Hello
>
> Is there a step by step using hilo article?
>
> I found out that in order to take advantage of batch commands in
> nhibernate
> you have to use hile generator (<generator class="hilo" />)
> I looked at Nh Doc and Nh in Action, it does not say much about it,
> I've came accross this statement:
>
> "Generates identifiers that are unique only for a particular database.
> A high/low algorithm
> is an efficient way to generate identifiers of any integral type,
> given a table and
> column (by default hibernate_unique_key and next_hi, respectively) as
> a source of hi
> values. See (Ambler 2002) for more information about the high/low
> approach to unique
> identifiers. Don’t use this generator with a user-supplied
> connection."
>
> I did not understood this part "Don’t use this generator with a user-
> supplied connection".
> Anybody know what he meant with this?
>
> I tried the hilo and it generates a table with the name
> "hibernate_unique_key" and one
> column "next_hi", It also generates high values for ID's like 32772
> I would like to understand this in depth, what are they for?
> If anybody knows a link that explains much in detail about hilo?
> I'm very curious to know about this.
>
> Visar
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to nhus...@googlegroups.com.
> To unsubscribe from this group, send email to
> nhusers+unsubscr...@googlegroups.com<nhusers%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhus...@googlegroups.com.
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to