I want to do a simple join to pull some data, like the following:
SELECT TOP (1) dbo.Wibble.Name, dbo.Oogle.TheValueIWantToSortBy, dbo.Thingymabob.Name AS Name2
FROM dbo.Wibble INNER JOIN
dbo.Thingymabob ON dbo.Wibble.Id = dbo.Thingymabob.WibbleId INNER JOIN
dbo.Oogle ON dbo.Thingymabob.Id = dbo.Oogle.Id
WHERE (dbo.Wibble.HicId = 3)
ORDER BY dbo.Oogle.TheValueIWantToSortBy DESC
I was told (fair enough, really) to use HQL to select it from the database, since we want to stick to objects (not my idea) etc etc etc, so I came up with :
FROM Wibble quackeroo INNER JOIN quackeroo.baaaa as baaaa WHERE quackeroo.Oogle.Hic = ? ORDER BY baaaa.TheValueIWantToSortBy
nHibernate gives me the following error, on a lovely asp.net yellow screen of death:
System.InvalidCastException: {"At least one element in the source array could not be cast down to the destination array type."}
According to the Castle Project Forum, :

(Incase the image gets truncated, it says "When you perform any kind of JOIN in HQL, you stop returning just the first object. You are now returning an IList containing object[] instances"
When I change the return type to IList, you get an error of:
You have accessed an ActiveRecord class that wasn't properly initialized. The only explanation is that the call to ActiveRecordStarter.Initialize() didn't include System.Collections.IList class
So, I try to do an Initialize on the IList, and get EXCATLY the same error as above.
Why cant APIs be easy to use, and actually documented?
An update:
It turns out, all you have to do is a SELECT quackeroo FROM .... to select the first object...I wish that was made clear somewhere.
And yes, I have obfuscated the object names. Im not crazy enough (yet) to start calling things like Quackeroo and baaaa. Yet. Theres still time though.