0

I´m using PostGres 8.3 and have NHibernate working fine with database... I´m creating a Conventions file and I´m having problem to configure the Primary key sequence... All my tables have a primary key called ID, so I did that :

...
mapper.BeforeMapClass += (modelInspector, type, classCustomizer) => {
            classCustomizer.Id(c => c.Column("ID"));
            classCustomizer.Id(c => c.Generator(Generators.Sequence));
};

When I try to Save a instance, I got that error:

ERROR: 42P01: relation "hibernate_sequence" does not exist

How Can I create a convention to that?

Thanks

1 Answer 1

1

have a look at How to properly use NHibernate By Code to get the next Sequence in Oracle?

Id(u => u.Id, map =>
            {
                map.Column("id");
                map.Generator(Generators.Sequence,
                              gmap => gmap.Params(new {sequence = "seq_name"}));
            });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.