Invalid object name 'hibernate_unique_key

I have this error when I try to save my entity: Invalid object name 'hibernate_unique_key

What is the problem? With SQL profiler, I have this query: select next_hi from hibernate_unique_key with (updlock, rowlock)

Can you help me?

I am using Asp.net mvc 2, Sharp Architecture (with smooth automation)

thank

+3
source share
1 answer

I found him. I need to change PrimaryKeyConvention of Fluent and install on native.

 public class PrimaryKeyConvention : IIdConvention
{
    public void Apply(FluentNHibernate.Conventions.Instances.IIdentityInstance instance)
    {
        instance.Column("Id");
        instance.UnsavedValue("0");
        //instance.GeneratedBy.HiLo("1000");
        instance.GeneratedBy.Native();
    }
}
+4
source

Source: https://habr.com/ru/post/1752371/


All Articles