NHibernate Exception with stored proc

210 views
Skip to first unread message

DBLWizard

unread,
Mar 15, 2012, 12:12:17 PM3/15/12
to nhusers
I'm fairly new to NHibernate and so I'm looking for some
recommendations or best practices.

In the following code after the GetNamedQuery is run the Query object
has two parameters ReturnAliases and ReturnTypes that have exception
values in them. This code comes from Codesmith's PLINQO templates.

Is there a recommended way to catch these types of exceptions and
bubble them up? I don't mind modifying the templates and regenerating
if I need to. But I'm looking for a recommended practice on these
types of things.

public IList<MSRP_EVENTSResult> MsrpEvent(System.String
scaseid)
{
IQuery query =
Advanced.DefaultSession.GetNamedQuery("MsrpEvent");
query.SetParameter("SCASEID", scaseid);

query.SetResultTransformer(
new
NHibernate.Transform.AliasToBeanConstructorResultTransformer(
typeof (MSRP_EVENTSResult).GetConstructors()[0]));

return query.List<MSRP_EVENTSResult>();
}

The ReturnAliase is : 'query.ReturnAliases' threw an exception of type
'System.NotSupportedException'
The ReturnTypes is : 'query.ReturnTypes' threw an exception of type
'System.NotSupportedException'

Thanks

dbl

Oskar Berggren

unread,
Mar 16, 2012, 10:43:12 AM3/16/12
to nhu...@googlegroups.com
2012/3/15 DBLWizard <ibfly...@yahoo.com>:

> I'm fairly new to NHibernate and so I'm looking for some
> recommendations or best practices.
>
>
> The ReturnAliase is : 'query.ReturnAliases' threw an exception of type
> 'System.NotSupportedException'
> The ReturnTypes is : 'query.ReturnTypes' threw an exception of type
> 'System.NotSupportedException'
>


That sounds like exceptions that occur when you are using the debugger
to view the values of the properties.


/Oskar

DBLWizard

unread,
Mar 16, 2012, 11:25:05 AM3/16/12
to nhusers
Yeah I discovered this after looking into it a bit. I'm guessing that
either in some where something wasn't fully implemented. It was a
little decieving because I was having some other issues at the time
that seemed to be related but turns out they weren't. These
properties are always set this way regardless of the success or
failure of the stored procedure.

Thanks

dbl

On Mar 16, 8:43 am, Oskar Berggren <oskar.bergg...@gmail.com> wrote:
> 2012/3/15 DBLWizard <ibflyfis...@yahoo.com>:
Reply all
Reply to author
Forward
0 new messages