Search code examples
nhibernatesdfhbm2ddl

NHibernate and hbm2dll update attribute


i'm using NHibernate with Sdf database. In my hibernate.cfg.xml file i've set:

<property name="hbm2ddl.auto" value="update"/>

But this does not seem to work at all. "Update" attribute should make NHibernate generate missing tables and columns during application launch, but it does not happen.

If i want missing tables geenrated I have to set hbm2dll.auto property to "create" which is not an option for me since it drops existing db content beforehand.

I experienced the same problem with PostgreSql problem. Am I missing something?


Solution

  • As far as I remember, I resolved the problem by using:

    new SchemaUpdate(_cfg);
    

    Please read about SchemaUpdate in NHibernate documentation.

    You can alternatively try using Fluent NHibernate which will definetely work as you expect and even better!