views:

205

answers:

1

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

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

Can you help me?

I'm using Asp.net mvc 2, Sharp Architecture (with fluent automapping)

Thank you

+4  A: 

i've found it. i need to change the PrimaryKeyConvention of Fluent and set to 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();
    }
}
Andrea
Thanks. Had the same problem and your post helped me.
mattRo55
Thanks, worked for me as well.
Dofs