tags:

views:

216

answers:

2

I dont understand why NHibernate returns an object[] when a join is performed but Hibernate does not. For example.

The mapping

The query session.CreateQuery("From CameraMount m left join m.Presets").List();

This will return an object[] where I would expect it to return a CameraMount that has its set of Presets initialized.

Why?

+1  A: 

I guess this is just the implementation that is slightly different due to support for generic and non-generic collections in .NET. If you want strongly typed CameraMount objects you could request:

List<CameraMount> cameramounts = 
session.CreateQuery("From CameraMount m left join m.Presets")
.List<CameraMount>();

instead. Hope that helps.

martijn_himself
+1  A: 

Also, you can try Select m from CameraMount m left join m.Presets This should give you the CameraMount Objects back.

Sree