Try with a newer ODP.NET

   Diego


On Mon, May 31, 2010 at 04:56, DanV <[email protected]> wrote:

> Hi guys,
>
> I 'm an NH version 2.1.2  humble user mostly with MSSQL server behind,
> but recently I changed the project and started to use it against
> Oracle 10g.
> I'm using Oracle Data Provider .Net 9.2 and this is my config file:
>
> <session-factory>
>      <property
> name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</
> property>
>      <property name="connection.connection_string">some connection
> string</property>
>      <!--<property name="show_sql">true</property>-->
>      <property name="dialect">NHibernate.Dialect.Oracle10gDialect</
> property>
>      <property name="query.substitutions">true 1, false 0, yes 'Y',
> no 'N'</property>
>      <property
>
> name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
> NHibernate.ByteCode.LinFu</property>
>  </session-factory>
>
> I'm trying to execute a store procedure that returns a sysref cursor
> just like the NH docs say.
> Problem is I don't get to the point of execution because NH throws an
> InvalidCastException. I pasted the details of the exception at the end
> of the post.
>
> I did a little digging myself following the stack trace and I found
> that:
> - SuppliedConnectionProviderConnectionHelper.Prepare() method tries to
> typecast the connection to DbConnection class:
> .....
>                               public void Prepare()
>                {
>                        connection = (DbConnection)provider.GetConnection();
>                }
> ......
>
> Then Reflector helped a little bit and I looked in Oracle.DataAccess
> assembly:
> public sealed class OracleConnection : Component, IDbConnection,
> IDisposable, ICloneable
>
> I didn't try to use the latest data access provider from Oracle.
> I can, of course provide other details like classes or mappings, or SP
> code if needed.
>
> I don't know if this qualifies for a bug but if it does I cand add a
> ticket to NH Jira and wait for it to be fixed, or at least to have it
> running in NH 3.0 if not already fixed there :), whatever considered
> best by NH developers because I know to work around this problem.
>
> Thanks,
>
> Dan
>
> 1. Exception details:
>
> System.InvalidCastException was unhandled
>  Message="Unable to cast object of type
> 'Oracle.DataAccess.Client.OracleConnection' to type
> 'System.Data.Common.DbConnection'."
>  Source="NHibernate"
>  StackTrace:
>       at
>
> NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare()
>       at
> NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect
> dialect, IConnectionHelper connectionHelper)
>       at
> NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory
> sessionFactory)
>       at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg,
> IMapping mapping, Settings settings, EventListeners listeners)
>       at NHibernate.Cfg.Configuration.BuildSessionFactory()
>       at
> OracleSPCall.ConfigurationManager.GetSessionFactory(Assembly[]
> inputAssemblies) in D:\Work\Projects\Tests\OracleSPCall
> \ConfigurationManager.cs:line 28
>       at OracleSPCall.Program.Main(String[] args) in D:\Work\Projects
> \Tests\OracleSPCall\Program.cs:line 14
>       at System.AppDomain._nExecuteAssembly(Assembly assembly,
> String[] args)
>       at System.AppDomain.ExecuteAssembly(String assemblyFile,
> Evidence assemblySecurity, String[] args)
>       at
> Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>       at System.Threading.ThreadHelper.ThreadStart_Context(Object
> state)
>       at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
>       at System.Threading.ThreadHelper.ThreadStart()
>  InnerException:
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to