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

前端 未结 1 1945
感情败类
感情败类 2021-02-08 14:21

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
         


        
1条回答
  •  长发绾君心
    2021-02-08 14:27

    NHibernate expects to find a value that stores the current hi value in that table, ie it first runs something like:

    current_hi = [SELECT max(next_hi) FROM hibernate_unique_key].
    

    So all you need to do is seed that table with an initial number, ie:

    INSERT INTO hibernate_unique_key(next_hi) VALUES (0)
    

    0 讨论(0)
提交回复
热议问题