Using with NHibernate / Fluent NHibernate

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
ColinBo
Posts: 9
Joined: Thu 27 Aug 2009 17:27
Location: Toronto, Canada

Using with NHibernate / Fluent NHibernate

Post by ColinBo » Fri 28 Aug 2009 17:13

Is anyone using dotConnect for Oracle with NHibernate and FluentNHibernate? How are you connecting to the driver? Using the latest GA bits I am hitting "ArgumentException:
Column 'ReservedWord' does not belong to table ReservedWords."

System.Data.DataRow.GetDataColumn(String columnName)
System.Data.DataRow.get_Item(String columnName)
NHibernate.Dialect.Schema.AbstractDataBaseSchema.GetReservedWords()
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect
dialect, IConnectionHelper connectionHelper)
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory
sessionFactory)
NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping
mapping, Settings settings, EventListeners listeners)
NHibernate.Cfg.Configuration.BuildSessionFactory()
FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in c:
\Documents and Settings\Administrator\dev\fluent-nhibernate\src
\FluentNHibernate\Cfg\FluentConfiguration.cs: line 93
FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in c:
\Documents and Settings\Administrator\dev\fluent-nhibernate\src
\FluentNHibernate\Cfg\FluentConfiguration.cs: line 98

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 31 Aug 2009 06:09

Here are the steps for setting up dotConnect for Oracle to work with NHibernate.
1. Please put the DevartDataOracleDriver.cs file to the \NHibernate-x.x.x.GA-src\src\NHibernate\Driver\ folder, and recompile the NHibernate project. The DevartDataOracleDriver.cs content should be the following:

Code: Select all

using NHibernate.SqlTypes;
using System.Data;
namespace NHibernate.Driver
{

	public class DevartDataOracleDriver : ReflectionBasedDriver
	{
		/// 
    /// Initializes a new instance of the  class.
		/// 
		/// 
    /// Thrown when the Devart.Data.Oracle assembly can not be loaded.
		/// 
    public DevartDataOracleDriver()
      : base(
      "Devart.Data.Oracle",
      "Devart.Data.Oracle.NHibernate.NHibernateOracleConnection",
      "Devart.Data.Oracle.NHibernate.NHibernateOracleCommand")
		{
		}

    /// 
    public override bool UseNamedPrefixInSql {
      get { return true; }
    }

    /// 
    public override bool UseNamedPrefixInParameter {
      get { return true; }
    }

    /// 
    public override string NamedPrefix {
      get { return ":"; }
    }    
	}
}
2. The client application needs dotConnect for Oracle v 5.25.39 and above.
3. The section, which configures NHibernate in web.config, should be like:

Code: Select all

    
    
      NHibernate.Dialect.Oracle9iDialect
      NHibernate.Driver.DevartDataOracleDriver
      User Id=scott;Password=tiger;Server=ORA	  
      NHibernate.Connection.DriverConnectionProvider
      NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
      
    
    
We will make a tutorial or an article about using NHibernate with our providers in the nearest future.

As for the mentioned error, could you please send us a small test project with appropriate DDL/DML script to reproduce the problem in our environment?

ColinBo
Posts: 9
Joined: Thu 27 Aug 2009 17:27
Location: Toronto, Canada

Post by ColinBo » Mon 31 Aug 2009 13:38

Shalex wrote:As for the mentioned error, could you please send us a small test project with appropriate DDL/DML script to reproduce the problem in our environment?
Where should I send it to? I should note that I am using FluentNHibernate 1.0 RC with NHibernate 2.1. This has been noted as a problem with the MySQL side as well.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 01 Sep 2009 10:53

Please try the implementation with dotConnect for Oracle v 5.25.39 in the way we have mentioned in the post above. If the problem persists, please send us a test project via our contact form (http://www.devart.com/company/contact.html).

ColinBo
Posts: 9
Joined: Thu 27 Aug 2009 17:27
Location: Toronto, Canada

Post by ColinBo » Wed 02 Sep 2009 18:39

I am using the latest version, I have emailed off the sample.

gsommer
Posts: 1
Joined: Wed 22 Dec 2010 08:22

Post by gsommer » Wed 22 Dec 2010 08:35

I have the same problem in dotConnect 5.70.146.0 (at least it looks very much like it) and I have also reported to Devart with a sample last friday. Currently I am waiting for a response.

Has this problem been solved for You?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 22 Dec 2010 16:35

1. gsommer, sorry for the delay. Your e-mail was blocked by our e-mail system, and we have started processing it only after your post in this thread. Your project works fine in our environment (Oracle Server v 10.2, Oracle Client v 10.2, dotConnect for Oracle v 5.70.146). We are investigating the possible reasons of the error you have got. Please try at your side the following steps to localize the problem:
a) connecting in the Direct mode: http://www.devart.com/dotconnect/oracle ... tMode.html;
b) if possible, try using different Oracle Server and/or Oracle Client.
Does the problem persist in this case as well?

2. As for ColinBo's project, there should be used

Code: Select all

public DevartDataOracleDriver()
: base("Devart.Data.Oracle", "Devart.Data.Oracle.NHibernate.NHibernateOracleConnection", "Devart.Data.Oracle.NHibernate.NHibernateOracleCommand") { }
istead of

Code: Select all

public DevartDataOracleDriver()
: base("Devart.Data.Oracle", "Devart.Data.Oracle.OracleConnection", "Devart.Data.Oracle.OracleCommand") { }
as we mentioned in this thread and in our blog.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 22 Dec 2010 16:42

The only change I have made in your project is adding log4net.dll v 1.2.10.0 to the ConsoleApplication1\Dependencies\NHibernate\2.1.2-GA\ folder.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 27 Dec 2010 09:15

We have reproduced the error. We are investigating this issue.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 19 Jan 2011 10:40

We have fixed the problem. Solution will be available in the next build. I will post here when it is available for download.

Additionally to our fix, you should change Program.DatabaseConnection() in your Program.cs

Code: Select all

        private static DbConnection DatabaseConnection
        {
            get
            {
                return new OracleConnection(
                    DatabaseConnectionString);
            }
        }
to

Code: Select all

        private static DbConnection DatabaseConnection
        {
            get
            {
              DbConnection con = new DevartOracleDriver().CreateConnection() as DbConnection;
              con.ConnectionString = DatabaseConnectionString;
              return con;
            }
        }

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 27 Jan 2011 16:04

New version of dotConnect for Oracle 6.10 is released!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only): http://secure.devart.com/ .
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=20115 .

Post Reply