dotConnect for PostgreSQL with NHibernate?

dotConnect for PostgreSQL with NHibernate?

Postby pgTrialGuy » 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!
pgTrialGuy
 
Posts: 3
Joined: Sat 25 Jul 2009 00:00

No response?

Postby pgTrialGuy » Tue 28 Jul 2009 17:22

I find it disconcerting that there's been no response from Devart to this post and to two separate support emails.

And as of tomorrow, my trial period ends... Is this the expected level of support?
pgTrialGuy
 
Posts: 3
Joined: Sat 25 Jul 2009 00:00

Postby Shalex » Wed 29 Jul 2009 09:30

Sorry for the delay. dotConnect for PostgreSQL supports NHibernate. Please try adding the Protocol=Ver20; entry to the connection string in the *.config file of your application.

The reason of the problem is the following.
dotConnect for PostgreSQL uses only prepared execution of queries now. Protocol 3.0 has an implementation for prepared execution and unprepared execution. Multiple execution with the protocol 3.0 is possible with unprepared execution only. That's why it is not allowed to use multiple execution with protocol 3.0 and dotConnect for PostgreSQL now.

Protocol 3.0 is the default protocol that is used by our provider. But you can use protocol 2.0 which allows multiple execution. Starting with PostgreSQL server 7.4, the new protocol version (3.0) is introduced. It is used by default by servers 7.4 and higher. However, sometimes you might require to use the older protocol (2.0), for example, when executing batch statements. In this case, set the Protocol property of PgSqlConnection to Ver20 to force the protocol version 2.0 usage.

If you encounter any difficulties, please contact us.
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44

Postby Shalex » Wed 29 Jul 2009 09:41

We will build dotConnect for PostgreSQL with prolonged evaluation (30 days more) and send to the e-mail address you have specified in the contact form of our site today or tomorrow.
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL