Just as with SQL, mixing inline HQL with business logic is generally a losing battle. The code becomes unreadable, and the queries are nearly impossible to properly unit test. In this recipe, I'll show you how we can move these HQL queries out of our code, improve readability and testability, and even improve performance by parsing and pre-compiling queries.
GetBookByISBN.hbm.xmlwith the following xml code. Don't forget to set the Build action to Embedded Resource.
<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> ...