It doesn't work this way either, it seems that nothing gets binded to
the parameter and the query is not even executed and an ADOException
is raised.
Using a parameter only seem to work when also setting the value
explicitly to the discriminator and using the proper SetXXX statement,
e.g in my example it would be:
var query = session.CreateQuery(hql).SetString("classtype","Wire");
Thx anyway :)
On Jan 6, 12:06 am, ccollie <[email protected]> wrote:
> i havent tried, but how about explicityl setting the type as a
> parameter. i.e.
>
> var query = session.CreateQuery(hql).SetParameter("classtype", typeof
> (WirePayment));
>
> On Jan 5, 4:44 am, DanV <[email protected]> wrote:
>
>
>
> > Hi,
>
> > i'm using NHibernate v 2.1 and I tried query a many to any association
> > where I try to get only values of a certain class of the possible
> > classes of the "any" part.
>
> > I'm using as an example the mappings and classes from Ayende's
> > example:
>
> >http://ayende.com/Blog/archive/2009/04/22/nhibernate-mapping-ltmany-t...
>
> > and I tried, according to NH reference to execute the following query:
>
> > select _order.OrderNo, _order.OrderNo
> > from Order _order
> > left join _order.Payments _payments
> > where _payments.class = 'BOLayer.WirePayment, BOLayer'
>
> > BOLayer is the assembly and namespace where I declared the classes.
>
> > Problem is the query does not return anything.
>
> > If instead I write the query like this:
> > select _order.OrderNo, _order.OrderNo
> > from Order _order
> > left join _order.Payments _payments
> > where _payments.class = 'Wire'
>
> > then I have some results back because NH generates following SQL
> > query:
> > select order0_.OrderNo as col_0_0_, order0_.OrderNo as col_1_0_ from
> > Orders order0_ left outer join OrderPayments payments1_ on
> > order0_.Id=payments1_.OrderId where payments1_.PaymentType='Wire'
>
> > As far as I could understand from NH reference
> > here:http://nhforge.org/doc/nh/en/index.html#queryhql-where
> > NH should be able to translate from the fully qualified name of the
> > class to the value of the discriminator declared in mappings.
>
> > Am I missing something? The querying only works when using directly
> > the value of the discriminator?- Hide quoted text -
>
> - Show quoted text -
--
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.