Not an Issue
Details
Details
Assignee
Unassigned
UnassignedReporter
Greg Persson
Greg PerssonComponents
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created July 9, 2012 at 3:51 PM
Updated November 14, 2012 at 12:01 PM
Resolved July 9, 2012 at 6:33 PM
The issue I’m facing was reported about 4 years ago @ https://forum.hibernate.org/viewtopic.php?f=25&t=989865
The problem is that NHibernate.Type.Nullable.NullSafeGet(IDataReader rs, string[] names, ISessionImplementor session, object owner) uses IDataReader.GetOrdinal for every single value in the ResultSet.
The MSDN page for GetOrdinal http://msdn.microsoft.com/en-us/library/system.data.idatarecord.getordinal.aspx states
“Because ordinal-based lookups are more efficient than named lookups, it is inefficient to call GetOrdinal within a loop. Save time by calling GetOrdinal one time and assigning the results to an integer variable for use within the loop.”
This problem does not manifest itself using the SqlDataProvider because it implements a caching mechanism to eliminate this problem. However, I’m using ODP.NET and its implementation of GetOrdinal is naïve and performs very slowly.
For a record set with 40 columns and 4000 rows, it takes about 3.7 seconds to Hydrate the nHibernate objects. The same database call using DataSets and DataAdapters takes about 0.3 seconds. This is because the DataAdapter does not use GetOrdinal at all.
ADO.NET Provider: ODP.NET 2.112.1.0 with 11g
NET 4.0