Question

I am using nhibernate 3.2 mapping by convention.

here's my code. in my hilo table, NextHi is 1. I delete all records in User table, then insert a new User there. Instead getting a really small number like 10 or 11, the first user I inserted has Id 32768. I dont know how i get this number. please let me know what should I check?

            mapper.BeforeMapClass += (modelInspector, type, classCustomizer) =>
                {
                    classCustomizer.Id(c => c.Column("Id"));
                    classCustomizer.Id(c => c.Generator(Generators.HighLow,
                        gmap => gmap.Params(
                            new{
                                max_low = 10, 
                                table = "Hilo", 
                                column = "NextHi", 
                                where = string.Format("TableKey = '{0}'", type.Name.ToLower())
                            })));

                };
Was it helpful?

Solution

The parameter should be named max_lo, not max_low. It has probably changed between initial (and only by now) description by Fabio Maulo and the production 3.2 release.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top