Thanks guys, Diego was quite right - it was totally my issue with having
incorrect data, I misunderstood the documentation and assumed it was a
limitation but it was due to my duff data...my fault!
Is there an identifier I can use to identify the type of concrete class in
an Icritera query, i.e. so I can group by the type and count? something like
this:
var criteria = session.CreateCriteria(typeof (CoreItem));
criteria.SetProjection(Projections.ProjectionList()
.Add(Projections.Property("<<<TYPE>>>"),
"Identifier")
.Add(Projections.Count("Id"), "Result")
.Add(Projections.GroupProperty("<<<TYPE>>")));
On Thu, May 6, 2010 at 9:01 PM, Diego Mijelshon <[email protected]>wrote:
> I don't see why you can't use a different inheritance strategy.
> NHibernate doesn't care in which assembly your classes are (of course,
> you'll need to use full type names).
>
> Anyway, your query should work. Are you sure you have persistent instances
> (rows) of both classes?
>
> Diego
>
>
>
> On Thu, May 6, 2010 at 09:40, kmoo01 <[email protected]> wrote:
>
>> Hi guys,
>> From the documentation I can see that implicit polymorphism, in my
>> case, will not generate SQL UNIONs when performing polymorphic
>> queries. but is there any way of looping through the concrete classes
>> and union the results manually?
>>
>> My scenario:
>>
>> Im using a "Table per concrete class" approach, and I don't hold
>> instances of the superclass
>>
>> Abstract class "CoreItem" (no mapping file needed)
>> Concrete class "ResearchItem" inheriting from "CoreItem" with mapping
>> file including all core item properties
>> Concrete class "TestItem" inheriting from "CoreItem" with mapping file
>> including all core item properties
>>
>> When I query the CoreItem like below I can see 2 queries run correctly
>> from sqlprofiler, but only the second is returned...
>>
>> ICriteria crit = session.CreateCriteria(typeof(CoreItem));
>> ..some expressions...
>> crit.List<CoreItem>();
>>
>>
>> Unfortunately I need to have the inheritance this way because the 2
>> concrete items actually live in separate assemblies, meaning the
>> abstract class doesn't have any knowledge of them (so cant do a
>> subclass mapping - as far as im aware...)
>>
>> Cheers guys,
>> kmoo01
>>
>> --
>> 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]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
--
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.