Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

Sometimes I really start wondering what's going on in my sourcecode: I'm trying to connect to PostGres 9.0 using npgsql 2.0.11.0, which I'm damn sure I already did, but right now, my program throws a NotSupportedException as it steps into the following :

ISessionFactory sf = Fluently.Configure()
                        .Database(PostgreSQLConfiguration.PostgreSQL82
                        .ConnectionString(c => c
                        .Host("localhost")
                        .Port(5432)
                        .Database("cw")
                        .Username("cw")
                        .Password("mypass")))
                        .Mappings(x => x.FluentMappings.AddFromAssemblyOf<MyMapping>())
                        .BuildSessionFactory();

The Stacktrace is quite neat to look at: Just one line.

at NHibernate.Dialect.Dialect.GetDataBaseSchema(DbConnection connection) in d:\CSharp\NH\nhibernate\src\NHibernate\Dialect\Dialect.cs:Line 718.

I tried transcribing this to the following:

ISessionFactory sf = Fluently.Configure()
                        .Database(PostgreSQLConfiguration.PostgreSQL82
                        .ConnectionString(c => c.Is("Server=localhost;Port=5432;Database=cw;User Id=cw;Password=myPass;")))
                        .Mappings(x => x.FluentMappings.AddFromAssemblyOf<CardTemplateMapping>())
                        .BuildSessionFactory();

Still, the result's the same. Anybody had similar issues or - even better - a fix?

share|improve this question
up vote 4 down vote accepted

I guess I'll end up holding a record for the most self-answered questions.

It needed the hbm2ddl.keywords property set to none. Now it works like a charm. Cheers!

 .Database(PostgreSQLConfiguration.PostgreSQL82
                        .Raw("hbm2ddl.keywords","none"));
share|improve this answer

See that you already found a solution. So just for some background:

The "none" will disable any operation regarding RDBMS KeyWords.

And the Keywords is available for MsSQL, Oracle, Firebird, MsSqlCe, MySQL, SQLite, SybaseAnywhere.

Since Postgress is not in the list it has to be set to None.

There is som info on it here: Quoting column names with NHibernate and PostgreSQL

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.