Problems with nHibernate / CastleActiverecord

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.

Funny moment

In the gym today, after a nice long workout:

Brother: "So can you get us some brocoli, as were out?"
Me: "Sure."
B: "Shouldnt cost too much"
M: "No probs"

As im leaving...

M: "Which ones brocoli again?"

Ruby on rails has derailed!

Well iv been bugged by a colleague to try out ruby on rails,from what I can tell, its good for quick development, but its pretty useless,and dosent follow OO principles, or any proper guidelines, from what I can tell(this is all taken from the http://tryruby.hobix.com/webby) :

Whats to_s ? Why is there an underscore there? Why isn’tit capitalised? And what is reverse? Surely you mean Reverse ?

to_i ? to_a ? This is the 21st century, were notrunning low on disk and memory space, you can use full variable names likeToString and ToInteger

I wonder what happens if you try to convert a string to aninteger?

0? HAH! Surely it should throw some kind of error?

Is there a point to the ! then, if it just ignores it?

But it seems if you don’t put a space between new andthe {, it just ignores you

To me at least, it seems like a really silly language. Itdosent follow any proper rules, in  my opinion, its just something fun todo.

Hosts file updater

I found a really cool nifty utility - HostsMan works really well with vista, if you remove the UAC (google for that)