Pierre Henri Kuaté, Christian Bauer, Gavin King, Tobin Harris1932394923, 978-1-932394-92-4
Table of contents :
NHibernate……Page 1
brief contents……Page 8
contents……Page 10
foreword……Page 18
preface……Page 22
acknowledgments……Page 24
Who should read this book……Page 26
Roadmap……Page 27
Author Online……Page 28
About the title……Page 29
About the cover illustration……Page 30
Discovering ORM with NHibernate……Page 32
Object/relational persistence in .NET……Page 34
1.1.1 Relational databases……Page 36
1.1.4 Persistence in object-oriented applications……Page 37
1.1.5 Persistence and the layered architecture……Page 38
1.2.1 Choice of persistence layer……Page 40
1.2.2 Implementing the entities……Page 42
1.2.3 Displaying entities in the user interface……Page 44
1.2.4 Implementing CRUD operations……Page 45
1.3.1 The paradigm mismatch……Page 46
1.3.2 Units of work and conversations……Page 47
1.3.3 Complex queries and the ADO.NET Entity Framework……Page 49
1.4.2 Why ORM?……Page 52
1.5 Summary……Page 54
Hello NHibernate!……Page 55
2.1.2 Create a new Visual Studio project……Page 56
2.1.3 Creating the Employee class……Page 57
2.1.5 Creating an Employee and saving to the database……Page 58
2.1.7 Creating a mapping file……Page 60
2.1.8 Configuring your application……Page 62
2.1.9 Updating an Employee……Page 63
2.2 Understanding the architecture……Page 64
2.2.1 The core interfaces……Page 66
2.2.2 Callback interfaces……Page 67
2.2.4 Extension interfaces……Page 68
2.3.1 Creating a SessionFactory……Page 69
2.3.2 Configuring the ADO.NET database access……Page 72
2.4.1 Using the application configuration file……Page 75
2.4.2 Logging……Page 78
2.5 Summary……Page 79
NHibernate deep dive……Page 80
Writing and mapping classes……Page 82
3.1.1 Analyzing the business domain……Page 83
3.1.2 The CaveatEmptor domain model……Page 84
3.2.2 Transparent and automated persistence……Page 86
3.2.3 Writing POCOs……Page 87
3.2.4 Implementing POCO associations……Page 89
3.2.5 Adding logic to properties……Page 92
3.3.1 Mapping using XML……Page 94
3.3.2 Attribute-oriented programming……Page 96
3.4.1 Property mapping overview……Page 97
3.4.3 Property access strategies……Page 99
3.4.4 Taking advantage of the reflection optimizer……Page 101
3.4.5 Controlling insertion and updates……Page 102
3.4.7 Naming conventions……Page 103
3.4.8 SQL schemas……Page 104
3.4.9 Declaring class names……Page 105
3.4.10 Manipulating metadata at runtime……Page 106
3.5.1 Identity versus equality……Page 107
3.5.2 Database identity with NHibernate……Page 108
3.5.3 Choosing primary keys……Page 110
3.6.1 Entity and value types……Page 112
3.6.2 Using components……Page 113
3.7.2 Multiplicity……Page 117
3.7.3 The simplest possible association……Page 118
3.7.4 Making the association bidirectional……Page 119
3.7.5 A parent/child relationship……Page 121
3.8 Mapping class inheritance……Page 122
3.8.1 Table per concrete class……Page 123
3.8.2 Table per class hierarchy……Page 124
3.8.3 Table per subclass……Page 126
3.8.4 Choosing a strategy……Page 129
3.9 Summary……Page 130
Working with persistent objects……Page 131
4.1 The persistence lifecycle……Page 132
4.1.2 Persistent objects……Page 133
4.1.3 Detached objects……Page 134
4.1.4 The scope of object identity……Page 135
4.1.5 Outside the identity scope……Page 136
4.1.6 Implementing Equals() and GetHashCode()……Page 137
4.2.1 Making an object persistent……Page 141
4.2.2 Updating the persistent state of a detached instance……Page 142
4.2.3 Retrieving a persistent object……Page 143
4.2.5 Making an object transient……Page 144
4.3 Using transitive persistence in NHibernate……Page 145
4.3.1 Persistence by reachability……Page 146
4.3.2 Cascading persistence with NHibernate……Page 147
4.3.3 Managing auction categories……Page 148
4.3.4 Distinguishing between transient and detached instances……Page 151
4.4 Retrieving objects……Page 152
4.4.1 Retrieving objects by identifier……Page 153
4.4.2 Introducing Hibernate Query Language……Page 154
4.4.4 Query by Example……Page 155
4.4.5 Fetching strategies……Page 156
4.4.6 Selecting a fetching strategy in mappings……Page 158
4.4.7 Tuning object retrieval……Page 163
4.5 Summary……Page 164
Transactions, concurrency, and caching……Page 165
5.1 Understanding database transactions……Page 166
5.1.1 ADO.NET and Enterprise Services/COM+ transactions……Page 167
5.1.2 The NHibernate ITransaction API……Page 168
5.1.3 Flushing the session……Page 169
5.1.4 Understanding connection-release modes……Page 170
5.1.5 Understanding isolation levels……Page 171
5.1.6 Choosing an isolation level……Page 172
5.1.8 Using pessimistic locking……Page 174
5.2.1 An example scenario……Page 177
5.2.2 Using managed versioning……Page 178
5.2.3 Optimistic and pessimistic locking compared……Page 180
5.2.4 Granularity of a session……Page 181
5.2.5 Other ways to implement optimistic locking……Page 182
5.3 Caching theory and practice……Page 183
5.3.1 Caching strategies and scopes……Page 184
5.3.2 The NHibernate cache architecture……Page 186
5.3.3 Caching in practice……Page 190
5.4 Summary……Page 195
Advanced mapping concepts……Page 197
6.1.1 Associations and value types……Page 198
6.1.3 Mapping types……Page 199
6.1.4 Built-in mapping types……Page 200
6.1.5 Using mapping types……Page 203
6.2.1 Storing value types in sets, bags, lists, and maps……Page 212
6.2.2 Collections of components……Page 217
6.3.1 One-to-one associations……Page 220
6.3.2 Many-to-many associations……Page 224
6.4 Mapping polymorphic associations……Page 231
6.4.1 Polymorphic many-to-one associations……Page 232
6.4.2 Polymorphic collections……Page 234
6.4.3 Polymorphic associations and table-per-concrete-class……Page 235
6.5 Summary……Page 236
Retrieving objects efficiently……Page 238
7.1.1 The query interfaces……Page 239
7.1.2 Binding parameters……Page 242
7.1.3 Using named queries……Page 245
7.2.1 The simplest query……Page 246
7.2.2 Using aliases……Page 247
7.2.4 Restriction……Page 248
7.2.5 Comparison operators……Page 249
7.2.6 String matching……Page 251
7.2.8 Ordering query results……Page 252
7.3 Joining associations……Page 253
7.3.1 NHibernate join options……Page 254
7.3.2 Fetching associations……Page 255
7.3.3 Using aliases with joins……Page 257
7.3.4 Using implicit joins……Page 259
7.3.5 Theta-style joins……Page 260
7.3.6 Comparing identifiers……Page 261
7.4 Writing report queries……Page 262
7.4.1 Projection……Page 263
7.4.3 Grouping……Page 265
7.4.5 Improving performance with report queries……Page 267
7.4.6 Obtaining DataSets……Page 268
7.5.1 Dynamic queries……Page 269
7.5.2 Collection filters……Page 271
7.5.3 Subqueries……Page 273
7.6 Native SQL……Page 274
7.6.1 Using the ISQLQuery API……Page 275
7.6.2 Named SQL queries……Page 277
7.6.3 Customizing create, retrieve, update, and delete commands……Page 279
7.7.1 Solving the n+1 selects problem……Page 280
7.7.2 Using Enumerable() queries……Page 283
7.7.3 Caching queries……Page 284
7.8 Summary……Page 286
NHibernate in the real world……Page 288
Developing NHibernate applications……Page 290
8.1 Inside the layers of an NHibernate application……Page 291
8.1.1 Using patterns and methodologies……Page 292
8.1.3 The domain model……Page 294
8.1.4 The business layer……Page 297
8.1.5 The persistence layer……Page 299
8.1.6 The presentation layer……Page 300
8.2 Solving issues related to .NET features……Page 301
8.2.2 .NET remoting……Page 302
8.3.1 Design goals applied to an NHibernate application……Page 303
8.3.2 Identifying and solving problems……Page 305
8.3.3 Use the right tool for the right job……Page 307
8.4 Integrating services: the case of audit logging……Page 308
8.4.2 Doing it the NHibernate way……Page 309
8.4.3 Other ways of integrating services……Page 314
8.5 Summary……Page 315
Writing real-world domain models……Page 317
9.1 Development processes and tools……Page 318
9.1.1 Top down: generating the mapping and the database from entities……Page 319
9.1.2 Middle out: generating entities from the mapping……Page 323
9.1.3 Bottom up: generating the mapping and the entities from the database……Page 324
9.1.4 Automatic database schema maintenance……Page 325
9.2 Legacy schemas……Page 327
9.2.1 Mapping a table with a natural key……Page 328
9.2.2 Mapping a table with a composite key……Page 329
9.2.3 Using a custom type to map legacy columns……Page 333
9.2.4 Working with triggers……Page 334
9.3.1 Abstracting persistence-related code……Page 336
9.3.2 Applying the Observer pattern to an entity……Page 338
9.4 Implementing the business logic……Page 340
9.4.2 Business logic in the domain model……Page 341
9.5 Data-binding entities……Page 343
9.5.1 Implementing manual data binding……Page 344
9.5.2 Using data-bound controls……Page 345
9.5.4 Data binding using ObjectViews……Page 346
9.6.1 Converting an entity to a DataSet……Page 347
9.7 Summary……Page 348
Architectural patterns for persistence……Page 350
10.1 Designing the persistence layer……Page 351
10.1.1 Implementing a simple persistence layer……Page 352
10.1.2 Implementing a generic persistence layer……Page 357
10.2 Implementing conversations……Page 366
10.2.1 Approving a new auction……Page 367
10.2.2 Loading objects on each request……Page 368
10.2.3 Using detached persistent objects……Page 369
10.2.4 Using the session-per-conversation pattern……Page 371
10.3 Using NHibernate in an Enterprise Services application……Page 375
10.3.1 Rethinking DTOs……Page 376
10.3.2 Enabling distributed transactions for NHibernateHelper……Page 377
10.4 Summary……Page 378
DDL and DML……Page 380
Queries……Page 381
What you need……Page 383
Staying up to date……Page 384
A……Page 386
C……Page 387
D……Page 388
E……Page 389
H……Page 390
I……Page 391
M……Page 392
N……Page 393
P……Page 394
Q……Page 395
S……Page 396
T……Page 397
W……Page 398
Reviews
There are no reviews yet.