Many people have asked over the past few months whether I will be offering a public course on NHibernate. The answer is now “Yes!” and it will be debuting in Calgary in August.

If you’re interested in OR/M with NHibernate and can’t come to Calgary, then maybe the course can come to you! Email me for more information on bringing the course to your city. I also offer this course privately if your company prefers that format. Once again, email me for more information.

If you’re interested, you can register for the Calgary course here (credit card). Please email me directly if you wish to pay via purchase order.

Object-Relational Mapping with NHibernate

Location The Westin Calgary
320 4th Avenue SW
Calgary, AB T2P 2S6
(map)
Dates Tuesday, August 26, 2008 to Thursday, August 28, 2008

Overview

Object-relational Mapping with NHibernate is an intensive 3-day course designed to introduce students to the core concepts of object-relational mapping (OR/M), such as querying and persisting objects to a relational database and mapping objects, collections, and inheritance relationships. The course will cover querying with the Hibernate Query Language (HQL) and the Criteria API. Students will learn how NHibernate encapsulates data access using the identity map and unit of work patterns, lazy loading, persistence by reachability, and automatic dirty checking. Advanced topics will be covered as student interest and time permit, including how and when to use the NHibernate’s 2nd level cache, building a persistence layer using the repository pattern, batching operations with multicriteria and multiqueries, and querying with LINQ to NHibernate.

Topics

  • Introduction to O/RM
  • Configuring NHibernate
  • Mapping Basics
    • Mapping primary keys
      • PK Types – Native, Identity, Guid, GuidComb, Sequence, HiLo
      • Composite Keys and why you shouldn’t use them
    • Mapping Fields and Properties
  • Querying Basics
    • ISession.Load/Get
    • hibernate.show_sql
  • Mapping Components
  • Schema generation
    • Using SchemaExport to create/update your database schema
    • Adding additional mapping attributes
  • The CUD in CRUD
    • Persistence by reachability
    • ITransaction
  • Mapping Relationships and Collections
    • One-to-one, one-to-many, and many-to-many
    • Handling cascades
    • Understanding Inverse=true
    • Lazy loading
    • Avoiding the N+1 SELECT problem
  • Mapping Inheritance hierarchies
    • Concrete table inheritance (table per concrete class with complete columns)
    • Single table inheritance (uses descriminator column and all possible columns)
    • Class table inheritance (aka table per class with diff of columns)
  • Advanced Querying
    • Querying with Hibernate Query Language (HQL)
    • Querying with the Criteria API
    • Projections
  • Optional Advanced Topics
    • Multicriteria and multiqueries
    • Future queries
    • Advanced querying with native SQL
    • NHibernate with sprocs
    • LINQ to NHibernate
    • Implementing a query govenor
    • Abstracting the persistence layer with unit of work
    • Optimizing database access with the level 2 cache

Requirements

  • Familiarity with C# and .NET Framework
  • Laptop with Visual Studio 2005 or 2008 and SQL Server 2005 Developer or Express installed

Included in the cost is:

  • 3-days of intensive training on NHibernate
  • Screencasts recorded during the course for easy review
  • NHibernate in Action by Kuate, et al. (ebook)
  • ReSharper 4.0 Personal License
  • All code examples created throughout the course