"Object reference not set" with batch_size in NHibernate

"Object reference not set" with batch_size in NHibernate

Postby GerbenRampaart » Wed 20 Jul 2011 09:35

Hi,

I am using NHibernate/oraConnect with the batch_size set to 100. This leads to the following NullReferenceException:

Code: Select all
[NullReferenceException: Object reference not set to an instance of an object.]
   NHibernate.AdoNet.OracleDataClientBatchingBatcher.SetObjectParam(Object obj, String paramName, Object paramValue) +88
   NHibernate.AdoNet.OracleDataClientBatchingBatcher.DoExecuteBatch(IDbCommand ps) +700
   NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps) +113
   NHibernate.AdoNet.AbstractBatcher.ExecuteBatch() +90
   NHibernate.AdoNet.AbstractBatcher.OnPreparedCommand() +29
   NHibernate.AdoNet.AbstractBatcher.PrepareCommand(CommandType type, SqlString sql, SqlType[] parameterTypes) +36


Apparently, something in the SetObjectParam method is null. So I did some research into NHibernate.dll and this is what the code looks like:

Code: Select all

protected override void DoExecuteBatch(IDbCommand ps)
    {
        // snip...

        // setting the ArrayBindCount on the OracleCommand
        // this value is not a part of the ADO.NET API.
        // It's and ODP implementation, so it is being set by reflection
        SetObjectParam(currentBatch, "ArrayBindCount", arraySize);

        // snip...
    }

private void SetObjectParam(Object obj, string paramName, object paramValue)
    {
      System.Type objType = obj.GetType();
      PropertyInfo propInfo = objType.GetProperty(paramName);
      propInfo.SetValue(obj, paramValue, null);
    }


Now, I am almost certain this fails on the fact that the "Devart.Data.Oracle.NHibernate.NHibernateOracleCommand" doesn't have a "ArrayBindCount" property. So the reflection fails, and so the batcher fails.

Our exact same code (a simple call to ISession.Save()) works just fine if I remove the 100 setting from the web.config.

Could you take a look a this for me?

Thx!
Gerben.

Note: I am using the ReflectionBasedDriver for NHibernate class described here: http://www.devart.com/blogs/dotconnect/?p=1857
GerbenRampaart
 
Posts: 4
Joined: Wed 20 Jul 2011 09:01
Location: Rotterdam, The Netherlands

Postby Shalex » Thu 21 Jul 2011 16:07

We have reproduced the problem. We will investigate it and notify you about the results as soon as possible.
Shalex
Devart Team
 
Posts: 7460
Joined: Thu 14 Aug 2008 12:44

Postby Shalex » Fri 22 Jul 2011 07:15

The bug with batch insert in NHibernate support is fixed. Look forward to the next build of dotConnect for Oracle. I will post here when it is available for download.
Shalex
Devart Team
 
Posts: 7460
Joined: Thu 14 Aug 2008 12:44

Wow

Postby GerbenRampaart » Mon 25 Jul 2011 08:31

Amazingly fast guys. As ever.

Keep this up because the fast support/response we've experienced is one of the main reasons we're choosing your product.
GerbenRampaart
 
Posts: 4
Joined: Wed 20 Jul 2011 09:01
Location: Rotterdam, The Netherlands

Postby Shalex » Fri 29 Jul 2011 09:20

New build of dotConnect for Oracle 6.30.196 is available for download!
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=21605 .
Shalex
Devart Team
 
Posts: 7460
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle