O'Reilly logo

NHibernate 3 Beginner's Guide by Gabriel N. Schenker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mapping our model

Now that we have defined and implemented the model for our simple product inventory application, we need to instruct NHibernate how to map our model classes to the underlying tables in the database. The mapping is responsible to define which class maps to which table, and which property of a class maps to which column of a table. Having defined this information, NHibernate can successfully operate and create the necessary SQL statements that allow us to add, update, and delete data in the database, as well as query existing data.

Various methods exist to show how we can define the mappings. Probably, the most common methods are either to define the mappings in the form of XML documents or to define them in code. In this chapter, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required