Thanks Fabio,

I've solved it by adding the following to the mapping:

<import class="Namespace.IDoSomething" rename="IDoSomething"/>

and then doing:

var results = session.CreateQuery("from IDoSomething").List<IDoSomething>();


Is that what you mean by mapping of the base interface as an abstract class,
or there is another way of doing this?


On Sun, Dec 21, 2008 at 7:58 AM, Fabio Maulo <[email protected]> wrote:

> You miss the mapping of the base interface as an abstract class.
>
> 2008/12/20 Germán Schuager <[email protected]>
>
> 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?
>>
>>
>>
>>
>
>
> --
> Fabio Maulo
>
> >
>

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