Hello
Can you please help us?
We are working on a C# project, which heavily relies on nHibernate and we need to migrate from MySQL to Postgres. nHibernate makes this process rather easy, however there are some questions that we can’t find answers for…
The first problem we’ve encountered is foreign keys. We have a lot of tables with one-to-one references with the following options:
On Update = CASCADE
On Delete = RESTRICT
however Hibernate Attributes Mapping Key property attribute OnDelete doesn’t have the restrict option and there is no OnUpdate attribute… So what should we do - is manual foreign keys addition the only way?
Another issue is Auto Increment - how should we enable it in case of Postgresql with nHibernate attributes? This is what we are using now:
private int id;
[Id(0, Column = “id”, Name = “Id”)]
[Generator(1, Class = “native”)]
public virtual int ID { get { return id; } }
Last question is related to ENUM types - how can we make nHibernate to generate requests like CREATE TYPE type_enum AS ENUM (‘A’,‘B’); and using them in the INSERT / UPDATE sql requests?