I`m a newbie in Fluent Nhibernate.
I have a PostgreSQL database and what I want is a generated id with auto increment.
I have not seen feature auto increment in PostgreSQL and I understand that to use auto increment in PostgreSQL I have to create a sequence.
Is there another way besides sequences?
If create sequence is the only way, can you tell me how I should mapping it?
I tried to use this and had no success:
mapping.Id(x => x.Id, "id").GeneratedBy.Sequence("hibernate-sequence");
I have created hibernate-sequence before using it.
Regards
Strange, but with your code an insertion works fine, if you call
Save(Object)instead ofSaveOrUpdate(Object)Edit #1
That’s what worked for me.
Entity:
And configuration with schema export: