views:

34

answers:

2

I'm using NHibernate. I have a class which has a nested type. Is there any way, using NHibernate, to query against the nested type, asides from using a native SQL query?

Nested classes are not allowed in HQL currently.

EDIT: The outer class has an IList of nested class instances.

+1  A: 

Use a component mapping.

More information @ http://stackoverflow.com/questions/1588591/nhibernate-nested-class-mapping-problem

Then, using HQL or Linq to NHibernate, you would simple say something like string hql = "from Store s where s.Employee.Id = 3";

Rafael Belliard
That won't work for me, unless a component can be mapped as a collection - the outer class contains an IList of nested class instances.
Remi Despres-Smyth
A: 

Can't be done currently.

Remi Despres-Smyth