Hello ppl,
Im still a newbie with NH, and I'v started developing a small test
application with NHv3.1, like a demo for a bigger project. I also
implemented support to work with stored procedures: sql-insert-update-
delete and sql-query to read instances from DB.
So, last week I switched to new version NHv3.2, changed configuration
to use NHibernate DefaultProxyFactoryFactory, and now I have a
problem. When I call a stored procedure to initialize a collection (to
read instances from DB) it throws an exception!? I've made a copy of a
whole solution, two identical codes except for configuration (see
below). Copy A working perfectly with NHv3.1, and copy B with NHv3.2
throws exception shown below:
* Exception:
NHibernate.Exceptions.GenericADOException was unhandled
Message=could not execute query
[ { ? = call PRODUCT_FUN() } ]
[SQL: { ? = call PRODUCT_FUN() }]
Source=NHibernate
SqlString={ ? = call PRODUCT_FUN() }
StackTrace:
at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs:line 1599
at
NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor
session, QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate
\src\NHibernate\Loader\Loader.cs:line 1497
// ... some more code...
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.IndexOutOfRangeException
Message=Index was outside the bounds of the array.
Source=NHibernate
StackTrace:
at
NHibernate.Param.PositionalParameterSpecification.SetEffectiveType(QueryParameters
queryParameters) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Param
\PositionalParameterSpecification.cs:line 73
at
NHibernate.Param.ParametersBackTrackExtensions.ResetEffectiveExpectedType(IEnumerable`1
parameterSpecs, QueryParameters queryParameters) in d:\CSharp\NH\NH
\nhibernate\src\NHibernate\Param\ParametersBackTrackExtensions.cs:line
48
// ... some more code...
at NHibernate.Loader.Loader.DoList(ISessionImplementor
session, QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate
\src\NHibernate\Loader\Loader.cs:line 1590
InnerException:
* Configuration:
public static Configuration buildConfiguration()
{
return new Configuration()
.SetProperty("connection.provider",
"NHibernate.Connection.DriverConnectionProvider")
.SetProperty("dialect",
"NHibernate.Dialect.Oracle10gDialect")
.SetProperty("connection.driver_class",
"NHibernate.Driver.OracleDataClientDriver")
.SetProperty("connection.connection_string",
@"Data Source=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)
)
)
);
User Id=xx;Password=xx;")
// A copy (NHv3.1):
//.SetProperty("proxyfactory.factory_class",
"NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle")
// B copy (NHv3.2):
.SetProperty("proxyfactory.factory_class",
"NHibernate.Bytecode.DefaultProxyFactoryFactory, NHibernate")
.SetProperty("show_sql", "true")
.SetProperty("query.substitutions", "true 1,
false 0, yes 'Y', no
'N'");
}
* Code:
using (ISession session = _sessionFactory.OpenSession())
{
// this part works fine:
IQuery q1 = session.CreateQuery("from Product
p");
IList list1 = q1.List();
foreach (Product p in list1)
Console.WriteLine(p.Name);
// but this one doesn't:
IQuery q2 =
session.GetNamedQuery("product_fun_sp");
IList list2 = q2.List(); // here throws an
exception!
foreach (Product p in list2)
Console.WriteLine(p.Name);
}
My guess is that I have a problem in configuration, with proxy
factory, but cant figure out what??
Please help, I need to get this working...
ps:
Person class has and ID property and a few other properties, no
relations to other classes.
Insert, update, delete stored procedures work fine.
--
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.