dotConnect for PostgreSQL with NHibernate?
Posted: Sat 25 Jul 2009 00:09
I'm currently in the eval period with dotConnect for PostgreSQL. I'm trying to get it working with NHibernate (current GA release) and not having a great deal of luck. I've searched the forum (no luck) and emailed the folks at DevArt (no response)... so I'm hoping maybe a customer or someone who has already tried this can help.
I had hoped that there'd be an NHibernate driver class for the dotConnect provider, but don't see one and there's no mention of NH in the docs.
I figured I'd create a driver class using the Npgsql driver class in the NH source as a template. It's fairly small and mostly just consists of providing the name of the provider's assembly (Devart.Data.PostgreSql) and the name of the IDbConnection and IDbCommand implementations (PgSqlConnection and PgSqlCommand). After doing this, configuring NH to use it, and adding the Devart references to my sample project, I'm so close... however executing the process to create database schema via NH yields:
NHibernate: INSERT INTO Category (Name, Owner) VALUES (:p0, :p1); select lastval();p0 = 'Fruits', p1 = NULL
TestCase 'pgNhibernateLib.Tests.ProductRepository_Fixture.Can_get_existing_product_by_id'
failed: NHibernate.Exceptions.GenericADOException : could not insert: [pgNhibernateLib.Domain.Category][SQL: INSERT INTO Category (Name, Owner) VALUES (?, ?); select lastval()]
----> Devart.Data.PostgreSql.PgSqlException : cannot insert multiple commands into a prepared statement
The odd thing here is that the class I created explicitly sets the SupportsPreparingCommands property to 'false'. I've also added an override of the MultipleQueriesSeparator property and set it to "/" - still no luck.
Any ideas? Anyone have the dotConnect Postgres provider working with NHibernate? Hoping I get this resolved before the trial is done...
Thanks!
I had hoped that there'd be an NHibernate driver class for the dotConnect provider, but don't see one and there's no mention of NH in the docs.
I figured I'd create a driver class using the Npgsql driver class in the NH source as a template. It's fairly small and mostly just consists of providing the name of the provider's assembly (Devart.Data.PostgreSql) and the name of the IDbConnection and IDbCommand implementations (PgSqlConnection and PgSqlCommand). After doing this, configuring NH to use it, and adding the Devart references to my sample project, I'm so close... however executing the process to create database schema via NH yields:
NHibernate: INSERT INTO Category (Name, Owner) VALUES (:p0, :p1); select lastval();p0 = 'Fruits', p1 = NULL
TestCase 'pgNhibernateLib.Tests.ProductRepository_Fixture.Can_get_existing_product_by_id'
failed: NHibernate.Exceptions.GenericADOException : could not insert: [pgNhibernateLib.Domain.Category][SQL: INSERT INTO Category (Name, Owner) VALUES (?, ?); select lastval()]
----> Devart.Data.PostgreSql.PgSqlException : cannot insert multiple commands into a prepared statement
The odd thing here is that the class I created explicitly sets the SupportsPreparingCommands property to 'false'. I've also added an override of the MultipleQueriesSeparator property and set it to "/" - still no luck.
Any ideas? Anyone have the dotConnect Postgres provider working with NHibernate? Hoping I get this resolved before the trial is done...
Thanks!