hilo

What's the Hi/Lo algorithm?

What's the Hi/Lo algorithm? I've found this in the NHibernate documentation (it's one method to generate unique keys, section 5.1.4.2), but I haven't found any good explanation of how does it work. I know that Nhibernate handles it, and I don't need to know the inside, but I'm just curious. ...

HiLo or identity?

Just wanted to get some opinions on primary keys - would it be better to use identity/sequence numbers or use a HiLo strategy (query for the high value and increment the low value on the app itself)? ...

Error with hilo in NHibernate - "could not read a hi value - you need to populate the table"

I've genereated a schema for my (SQL 2005) db using SchemaExport, and it's created a table CREATE TABLE [dbo].[hibernate_unique_key]( [next_hi] [int] NULL ) ON [PRIMARY] When I try to add an entity, I get the error "could not read a hi value - you need to populate the table". What am I meant to do? edit: I've inserted a 1 into th...

Are there any gotchas when using HiLo if you need to use replication later?

Currently we only use one database server, and that should be all we need for quite some time. However if I was to convert the database to use HiLo for a POID strategy is there anything I can do now that would make sure I don't have problems with replication later? Is HiLo even compatible with replication? I am actually having quite a...

NHibernate HiLo - new column per entity and HiLo catches

Im currently using the hilo id generator for my classes but have just been using the minimal of settings eg <class name="ClassA"> <id name="Id" column="id" unsaved-value="0"> <generator class="hilo" /> </id> ... But should I really be specifying a new column for NHibernate to use foreach entity and providing it with a ...

NHibernate HiLo ID generator is performing a round-trip to the database per-row inserted

When I configure my application to use HiLo Id generation, I see one round-trip per row inserted in the database. All the documentation I've read has indicated that I should see far fewer round-trips. My objects are all generally configured (fluently) as such: Id(t=>t.Id).GeneratedBy.HiLo("MyObject_Identity","MaxId","1000"); Addition...

Is there a practical way of migrating from identity columns to hilo keys?

I work with a database that depends heavily on identity columns. However as we have now moved all applications over to NHibernate I wanted to look into using HiLo as seems to be recommended with NHibernate. Are there any strategies to do this, or any common problems to watch out for? ...

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) { instance.GeneratedBy.HiLo("1000"); } } Now this works ...

Fluent NHibernate — specify table/column names when using HiLo generator

Yes, nit-picky is a good way to describe this... ;) Does anyone know if you can specify the table and/or column names to use HiLo using Fluent NHibernate? Currently the schema export creates this... create table hibernate_unique_key ( next_hi INTEGER ) ...

NHibernate and hilo generator: how to design key-tables?

I'm about to switch some of my entities from identity to hilo id-generator. I'm don't have a clue how the tables holding the next-high values should be designed. should I use a single table for all entities, or for a group of related entities? should I use another table for each entity? should I use a single table with another row or ...

What datatype should be used for the Id primary key columns using a hilo generator and sql server?

If I am using a hilo generator with nhibernate, what should the datatype for my id column be? int or bigint? ...

HiLo: how to control Low values

I'm using the HiLo generator in my S#rpArchitecture/NHibernate project and I'm performing a large import batch. I've read somewhere about the possibility to predict the Low values of any new records because they are generated on the client. I figure this means I can control the Low values myself or at least fetch the next Low value from...

HiLo vs Identity?

This is the same question as: http://stackoverflow.com/questions/803872/hilo-or-identity Let's take the database of this site as an example. Lets say that the site has the following tables: Posts. Votes. Comments. What is the best strategy to use for it: Identity - which is more common. OR HiLo - which give best performance. ...

When using a HiLo ID generation strategy, what types should be used to hold Ids?

I'm asking this from a c#/NHibnernate perspective, but it's generally applicable. The concern is that the HiLo strategy goes though id's pretty quickly, and for example a low record-count table (Such as Users) is sharing from the same set of id's as a high record-count table (Such as comments). So you can potentially get to high number...

NHibernate Hi-Lo

Yo Quick q: are Nhibernate HiLo ids unique accross the DB? The reason I ask is that we have multiple entities which have an image associated with them. On the client - I am simply storing these images in a folder using the enity ID as the name - am I going to trip over doing this? w:// ...

hilo generator in classic asp

Is it possible to implement a hilo generator in classic asp? How would this be done? ...

Nhibernate id’s with sequential one step incremented id’s (alternatives to HiLo)

How do I instruct Nhibernate to generate sequential one step primary keys, like the sql generated ones? The current HiLo algorithm generates keys like 4001 then 5010, 6089 etc. I understand that this is to manage multiple app servers etc. But I don’t have that problem. I need nhibernate to pick up the highest record set value during...

NHibernate HiLo generation and SQL 2005/8 Schemas

I have an issue on my hands that I've spent several days searching for an answer to no avail... We're using HiLo Id generation, and everything seems to be working fine, as long as the entity table is in the same schema as the hibernate_unique_key table. The table structure is pretty simple. I have my hi value table in the db as dbo.hib...

Once a HiLo is in use, what happens if you change the capacity (maximum Lo)?

If I start using a HiLo generator to assign ID's for a table, and then decide to increase or decrease the capacity (i.e. the maximum 'lo' value), will this cause collisions with the already-assigned ID's? I'm just wondering if I need to put a big red flag around the number saying 'Don't ever change this!' Note - not NHibernate specific...

HiLO for the Entity Framework

Has anyone implemented a HiLO key generator for the Entity Framework. Read more about HiLo here: I recommend that you read http://fabiomaulo.blogspot.com/2009/02/nh210-generators-behavior-explained.html for a detailed explanation of the downsides of choosing identity. ...