Are posts a child collection on your object being mapped? I ask, because
there might be an alternative to getting you that number. If you map a
Posts.Count() to a property, then map that with a read only accessor, it
should give you a similar solution.

On Mon, Oct 12, 2009 at 6:41 AM, Paul Batum <paul.ba...@gmail.com> wrote:

> Can you post your domain object and the mapping override for it?
> I figure something else has to be screwing up the result of the formula.
>
>
> On Mon, Oct 12, 2009 at 4:06 PM, Schlaefisch 
> <schlaefi...@googlemail.com>wrote:
>
>>
>> The exact query results in a syntax error, when I replace "this_.Id =
>> @p0;@p0 = 1" with "this_.Id = 1" the result is correct.
>>
>> But even when I use "SELECT 5" as formula, the PostCount is still 0.
>>
>>
>> On Oct 6, 1:16 pm, Paul Batum <paul.ba...@gmail.com> wrote:
>> > Off the top of my head, I can't see anything wrong with your mapping.
>> I've
>> > used formula columns with automapping for similar purposes without
>> problems.
>> > Have you executed that generated query against the db and confirmed that
>> it
>> > returned the correct results?
>> >
>> > On Fri, Oct 2, 2009 at 9:06 AM, Schlaefisch <schlaefi...@googlemail.com
>> >wrote:
>> >
>> >
>> >
>> > > Update: The Console Output.
>> >
>> > > Manual SQL:
>> > > NHibernate: (SELECT COUNT(*) FROM forumPosts p where p.TopicID = 1)
>> > > Mapping SQL:
>> > > NHibernate: SELECT top 2 this_.Id as Id0_0_, this_.Title as Title0_0_,
>> > > this_.Created as Created0_0_, this_.DisplayPriority as DisplayP4_0_0_,
>> > > this_.ForumID as ForumID0_0_, (SELECT COUNT(*) FROM forumPosts p where
>> > > p.TopicID = this_.Id) as formula0_0_ FROM forumTopics this_ WHERE
>> > > this_.Id = @p0;@p0 = 1
>>
>>
>
> >
>


-- 
- Hudson
http://www.bestguesstheory.com
http://twitter.com/HudsonAkridge

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to