Summer of NHibernate Session 06: Querying of Child Collections is now available

lighning I’m happy to announce that the next installment in the Summer of NHibernate screencast series is now available for general download from the main Summer of NHibernate site.  This session was actually recorded in the middle of a raging thunderstorm that passed thru New York City so if you listen closely to the audio you can perhaps pick out the booming of thunder at certain points in the recording; hopefully its not too distracting fingerscrossed.

That same storm actually temporarily knocked power out in my house for about 15-20 seconds and I was only able to keep recording thanks to the battery in my laptop — I guess there’s a good argument for not trying to record these on my desktop PC smile_teeth.  If you watch closely, about 42 minutes into the screencast I loose my Ethernet connection and the network icon in the system tray pops up to tell me — that’s my 100-mip switch going dark for about 30 secs before power came back up properly.  It wasn’t annoying enough to actually re-record that section so I just left it as-is.

Anyway, in this session we spend some up-front time evolving the way our NHibernateDataProvider class handles NHibernate session management to allow it to properly support our needs to do lazy-loading, separate the concern of creating sessions themselves out into a new NHibernateSessionManager class, and push the responsibility for creating sessions up into our test methods themselves so that they can properly manage session life-span at that level.

After we take care of those housekeeping chores, we move on to demonstrate querying across child collections in 1:many relations using both HQL and the Criteria API and then also spend some time digging into understanding the different ways that both query platforms support returning distinct objects from queries.

As always, comments, feedback, input, suggestions, and general criticism are appreciated from all.