Question

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?

Was it helpful?

Solution 2

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!

OTHER TIPS

Just got the same issue. I changed the way the property is defined. Instead of:

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

I used:

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

Then it worked :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top