Hi, I need some help using HQL to query all objects that implement a
specific interface.

I have the following classes:

    public class CommonClass

    public interface IDoSomething

    public class ClassA : CommonClass, IDoSomething

    public class ClassB : CommonClass, IDoSomething

    public class ClassC : CommonClass

I'm mapping this set of classes using table-per-subclass strategy.

Querying using Criteria API works as expected:
var results =
session.CreateCriteria(typeof(IDoSomething)).List<IDoSomething>();

But the following hql query does not work at all:
var results = session.CreateQuery("from
Namespace.IDoSomething").List<IDoSomething>();

it throws this exception:
NHibernate.QueryException : undefined alias or unknown mapping: NHibernate
[from Namespace.IDoSomething]

Can someone point me what I'm missing here?

--~--~---------~--~----~------------~-------~--~----~
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