Hello,

I have searched around on the board, and elsewhere on the internet and
cannot seem to find any answers to this problem. Also I have started
debugging into the nHibernate 2.0.1 source, but can't seem to see
where the aliasing is applied in the formula.

I have an entity called 'Event' with a property formula that looks
like this:
<property name="CoachingStatus">
<formula>
(SELECT MIN(CONVERT(int,ec.CounselStatus))) FROM dbo.l_EventCounsel ec
WHERE ec.eventid=eventid)
</formula>
</property>

The problem I am having is that the data type (int in this case, but I
have tried integer, bigint, and tinyint) is being considered as a
column and getting the outer table's alias?!

(SELECT MIN(CONVERT(this_.int,ec.CounselStatus))) FROM
dbo.l_EventCounsel ec WHERE ec.eventid=this_.eventid)

SQL Server then chokes on the query. Are there any rules as to when an
alias is applied? The only NH documentation I can find says:
"Note that you can reference the entities own table by not declaring
an alias on a particular column"
and this post (http://ayende.com/Blog/archive/2006/10/01/
UsingSQLFunctionsInNHibernate.aspx) from Ayende says:
"NHibernate will automatically pre-pend the alias of the current
entity table to anything that looks like a unqualified column access."

I'm glad to dig into why and even work on a solution, but I kinda need
a head-start as to where to look in the code for this functionality.

thanks in advance,
Thunder

P.S. My Environment:
NHibernate 2.0.1
SQL Server 2005
VisualStudio 2008 SP1

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