在部署OLAT到myeclipse,数据库配置正确的情况下,出现异常:Error with hilo in NHibernate - “could not read a hi value - you

异常信息:

“could not read a hi value - you need to populate the table:hibernate_unique_key.....”

 

解决方法:

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 the table, and it seems to work. Is this the correct value to have in there?

Solution:

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) 

 

你可能感兴趣的:(数据库,Hibernate,MyEclipse,schema,table,insert)