Questions tagged [hilo]

HiLo algorithm used for generating Ids for databases

The basic idea is that you have two numbers to make up a primary key- a "high" number and a "low" number. A client can basically increment the "high" sequence, knowing that it can then safely generate keys from the entire range of the previous "high" value with the variety of "low" values.

For instance, supposing you have a "high" sequence with a current value of 35, and the "low" number is in the range 0-1023. Then the client can increment the sequence to 36 (for other clients to be able to generate keys while it's using 35) and know that keys 35/0, 35/1, 35/2, 35/3... 35/1023 are all available.

It can be very useful (particularly with ORMs) to be able to set the primary keys on the client side, instead of inserting values without primary keys and then fetching them back onto the client. Aside from anything else, it means you can easily make parent/child relationships and have the keys all in place before you do any inserts, which makes batching them simpler.

What's the Hi/Lo algorithm?

69 questions
0
votes
1 answer

generator classes NHibernate

I have been using the generator class assigned to assign my primary key values. I have read several blogs which state that hilo is better. Is there a benefit to assigned over hilo?
user195488
0
votes
1 answer

Nhibernate cannot read from HiLo table using Oracle Database. (Could not read a hi value from table) Is this known bug?

Setup: Oracle 11g Enterprise Edition Release 11.2.0.1.0 64bit Production Toad For Oracle 12.1.0.22 Nhibernate 4.0.0.4000 Fluent Nhibernate 2.0.1.0 Projects develop under C# 4.5.1 Fluent Configuration: var configuration = Fluently.Configure() …
altyne
  • 159
  • 3
  • 14
0
votes
1 answer

NHibernate many-to-many inserts null id with hilo generator

I have 3 tables: User, Department and UserDepartment. User can be associated with multiple departments and department can be associated with multiple users. I use many-to-many fluent mapping on both sides like this: For Department HasManyToMany(x =>…
vsevolod
  • 155
  • 2
  • 10
0
votes
1 answer

error using Hilo example app in Visual C 2010

I am using Visual Studio 2010 Ultimate and I get the following when I compile the example project in Chapter 2: http://msdn.microsoft.com/en-us/library/windows/desktop/ff795784.aspx The error is this: 'uicc.exe' is not recognized as an internal or…
ThePrince
  • 818
  • 2
  • 12
  • 26
0
votes
3 answers

Fluent NHibernate — class/entity specific next_hi seeds when using HiLo generator

Basically I'm trying to do the same thing as this question but with Fluent NHibernate. Here is my id generation convention: public class IdGenerationConvention : IIdConvention { public void Apply(IIdentityInstance instance) …
Sean Gough
  • 1,721
  • 3
  • 26
  • 47
0
votes
1 answer

Programmatically get a unique integer using HNibernate HiLo generator

I have a need to generate a unique integer which I use to identify an order to an external system. I'm using the NHibernate HiLo generator in the application, so can I access the generator programmatically to get it to return me a unique integer? I…
Mike Scott
  • 12,274
  • 8
  • 40
  • 53
0
votes
1 answer

Pk Data Type Choice For Nhibernate?

When I started using nhibernate I just did what I always used an incrementing int. Now that I know more about nhibernate and the unit of work I feel like incrementing ints are not a good way to go(they break the unit of work). I am wondering what…
chobo2
  • 83,322
  • 195
  • 530
  • 832
-1
votes
1 answer

How is the "HiVal" value determined for the Hi-Lo algorithm in NHibernate?

What is the current value that Atlassian Confluence is using for their "HiVal"-value for the Hi-Lo algorithm in NHibernate? Is this a hard-coded value, or is it determined algorithmically? Is it documented somewhere?
Rebam1
  • 23
  • 3
  • 10
-4
votes
2 answers

Code keeps saying I haven't initialized my string variable 'restart' in my code for a guessing game

I am trying to build a guessing game for an assignment I am currently working on using loops. I am trying to get my game to give the user the option to play again. I was having a hard time trying to set up this last bit of code so I followed an…
1 2 3 4
5