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-to-anygt.aspx

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?

--

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