A
ACID (atomicity, consistency, isolation, and durability), 71 – 76
business and system transactions, 74 – 76
reducing transaction isolation for liveness, 73 – 74
transactional resources, 72 – 73
Active Record, 160 – 164
example
simple person (Java), 162 – 164
how it works, 160 – 161
when to use it, 161 – 162
ADO.NET data sets, 148 – 151
Advice, some technology-specific, 100 – 103
Java and J2EE, 100 – 101
.NET, 101 – 2
stored procedures, 102 – 3
Web services, 103
Affinity, server, 85
Albums and tracks (Java), 264 – 267
Albums, transferring information about, 407 – 411
Application Controller, 379 – 386
example
state model Application Controller (Java), 382 – 386
further reading, 382
how it works, 380 – 381
when to use it, 381 – 382
Application Controller, state model, 382 – 386
Application server concurrency, 78 – 80
Applications, evolution of layers in enterprise, 18 – 19
Architectural patterns, 33 – 38
Architectural patterns, data source, 143 – 181
Active Record, 160 – 164
Data Mapper, 165 – 181
Row Data Gateway, 152 – 159
Table Data Gateway, 144 – 151
ASP.NET server page (C#), 357 – 360
Association Table Mapping, 248 – 261
examples
employees and skills (C#), 250 – 253
using direct SQL (Java), 253 – 256
using single query for multiple employees (Java), 256 – 261
how it works, 248 – 249
when to use it, 249
B
Base patterns, 465 – 510
Gateway, 466 – 472
Layer Supertype, 475
Mapper, 473 – 474
Money, 488 – 495
Plugin, 499 – 503
Record Set, 508 – 510
Registry, 480 – 485
Separated Interface, 476 – 479
Service Stub, 504 – 7
Special Case, 496 – 498
Value Object, 486 – 487
Behavioral patterns, object-relational, 183 – 214
Identity Map, 195 – 199
Lazy Load, 200 – 214
Unit of Work, 184 –94
Behavioral problem, 38 – 39
Boosters, complexity, 24
Boundaries, working with distribution, 91 – 92
Brown layers, 104
Business and system transactions, 74 – 76
Business logic, 20
C
C#
ASP.NET server page, 357 – 360
collection of references, 244 – 247
concrete players, 296 – 301
employees and skills, 250 – 253
integral key, 221 – 222
page handler with code behind, 340 – 343
Person Gateway, 146 – 148
players and their kin, 287 – 292
revenue recognition with Table Module, 129 – 132
simple null objects, 498
single table for players, 280 – 281
using ADO.NET data sets, 148 – 151
using ghosts, 206 –14
Web service, 395 – 400
Cases, Special, 496 – 498
example
simple null objects (C#), 498
further reading, 497
how it works, 497
when to use it, 497
Class, money, 491 – 495
Class Table Inheritance, 285 – 292
example
players and their kin (C#), 287 – 292
further reading, 287
how it works, 285 – 286
when to use it, 286 – 287
Client Session State, 456 – 457
how it works, 456 – 457
when to use it, 457
Coarse-Grained Lock, 438 – 448
examples
root Optimistic Offline Lock (Java), 447 – 448
shared Optimistic Offline Lock (Java), 441 – 446
shared Pessimistic Offline Lock (Java), 446 – 447
how it works, 438 – 441
when to use it, 441
Committed, read, 73
Complexity boosters defined, 24
Compound key (Java), 224 – 235
Concrete players (C#), 296 – 301
Concrete Table Inheritance, 293 – 301
example
concrete players (C#), 296 – 301
how it works, 293 – 295
when to use it, 295 – 296
Concurrency, 63 – 80
application server, 78 – 80
application server concurrency, 78 – 80
concurrency problems, 64 – 65
execution contexts, 65 – 66
isolation and immutability, 66 – 67
off line, 75
offline, 63
optimistic and pessimistic concurrency controls, 67 – 71
patterns for off line concurrency control, 76 – 78
Concurrency controls
optimistic and pessimistic, 67 – 71
ACID (atomicity, consistency, isolation, and durability), 71 – 76
deadlocks, 70 – 71
preventing inconsistent reads, 68 – 69
transactions, 71
patterns for offline, 76 – 78
Concurrency patterns, offline, 415 – 453
Connections, database, 50 – 52
Contexts, execution, 65 – 66
Controller, Front, 344 – 349
example
simple display (Java), 347 – 349
further reading, 347
how it works, 344 – 346
when to use it, 346
Controller, Page, 333 – 343
examples
page handler with code behind (C#), 340 – 343
simple display with JSP view (Java), 335 – 337
simple display with servlet controller (Java), 335 – 337
using JSP as handler (Java), 337 – 340
how it works, 333 – 334
when to use it, 334 – 335
Controller patterns, input, 61
Controllers
simple display with, 335 – 337
state model Application, 382 – 386
using JSP as view with separate, 355 – 357
Controllers, Application, 379 – 386
example
state model Application Controller (Java), 382 – 386
further reading, 382
how it works, 380 – 381
when to use it, 381 – 382
Controls
optimistic and pessimistic concurrency, 67 – 71
ACID (atomicity, consistency, isolation, and durability), 71 – 76
deadlocks, 70 – 71
preventing inconsistent reads, 68 – 69
transactions, 71
patterns for offline concurrency, 76 – 78
Correctness, 65
Custom tags, JSP and, 374 – 378
D
Data
immutable, 67
reading in, 40 – 41
record, 83
Data holder for domain object (Java), 158 – 159
Data Mapper, 165 – 181
domain layer with, 421 – 425
examples
creating empty objects (Java), 179 – 181
separating finders (Java), 176 – 179
simple database mapper (Java), 171 – 176
how it works, 165 – 170
when to use it, 170 – 171
Data sets, ADO.NET, 148 – 151
Data source
architectural patterns, 143 – 181
Active Record, 160 – 164
Data Mapper, 165 – 181
Row Data Gateway, 152 – 159
Table Data Gateway, 144 – 151
for Domain Models, 98 – 99
logic, 20
Table Modules, 98
for Transaction Scripts, 97 – 98
Data source layers, down to, 97 – 100
data source for Domain Models, 98 – 99
data source for Transaction Scripts, 97 – 98
data source Table Modules, 98
presentation layers, 99 – 100
Data Transfer Objects, 401 – 413
examples
serializing using XML (Java), 411 – 413
transferring information about albums (Java), 407 – 411
further reading, 407
how it works, 401 – 6
when to use it, 406
Database connections, 50 – 52
Database mapper, simple, 171 – 176
Database Session State, 462 – 464
how it works, 462 – 463
when to use it, 464
Databases
loading objects from, 281 – 284
mapping to relational, 33 – 53
architectural patterns, 33 – 38
behavioral problem, 38 – 39
building mapping, 47 – 49
database connections, 50 – 52
Databases, mapping to relational, continued
reading in data, 40 – 41
some miscellaneous points, 52 – 53
structural mapping patterns, 41 – 47
using metadata, 49 – 50
Deadlocks, 70 – 71
Department hierarchy, serializing, 274 – 277
Dependent Mapping, 262 – 267
example
albums and tracks (Java), 264 – 267
how it works, 262 – 263
when to use it, 263 – 264
Dependents, finding person’s, 325 – 326
Dirty reads, 74
Display, simple, 347 – 349
Distributed objects, allure of, 87 – 88
Distribution boundaries, working with, 91 – 92
Distribution, interfaces for, 92 – 93
Distribution patterns, 387 – 413
Data Transfer Objects, 401 – 413
Remote Facade, 388 – 400
Distribution strategies, 87 – 93
allure of distributed objects, 87 – 88
interfaces for distribution, 92 – 93
remote and local interfaces, 88 – 90
where you have to distribute, 90 – 91
working with distribution boundaries, 91 – 92
DNA layers, Microsoft, 105
Domain layer with Data Mappers (Java), 421 – 425
Domain layers, starting with, 96 – 97
Domain logic, 20
organizing, 25 – 32
making choices, 29 – 30
Service Layers, 30 – 32
patterns, 109 – 141
Domain Model, 116 – 124
Service Layer, 133 – 141
Table Module, 125 – 132
Transaction Script, 110 – 15
Domain Model, 116 – 124
data source for, 98 – 99
example
revenue recognition (Java), 120 – 124
further reading, 119 – 120
how it works, 116 – 119
when to use it, 119
Domain objects, data holder for, 158 – 159
Domain objects (Java), 475
E
EAI (Enterprise Application Integration), 468
Embedded Value, 268 – 271
example
simple value objects (Java), 270 – 271
further reading, 270
how it works, 268
when to use it, 268 – 269
Employees and skills (C#), 250 – 253
Employees, using single query for multiple, 256 – 261
Enterprise Application Integration (EAI), 468
Enterprise applications, evolution of layers in, 18 – 19
Examples
albums and tracks (Java), 264 – 267
ASP.NET server page (C#), 357 – 360
collection of references (C#), 244 – 247
concrete players (C#), 296 – 301
data holder for domain object (Java), 158 – 159
domain objects (Java), 475
employees and skills (C#), 250 – 253
finding person’s dependents (Java), 325 – 326
gateway to proprietary messaging service (Java), 468 – 472
Id Generator (Java), 501 – 3
implicit Pessimistic Offline Lock (Java), 451 – 453
integral key (C#), 221 – 222
lazy initialization (Java), 203
methods for Identity Map (Java), 198 – 199
money class (Java), 491 – 495
multitable find (Java}, 243 – 244
Person Gateway (C#), 146 – 148
person record (Java), 155 – 158
players and their kin (C#), 287 – 292
revenue recognition (Java), 120 – 124 , 138 – 141
revenue recognition with Table Module (C#), 129 – 132
root Optimistic Offline Lock (Java), 447 – 448
sales tax service (Java), 505 – 7
separating finders (Java), 176 – 179
serializing department hierarchy in XML (Java), 274 – 277
serializing using XML (Java), 411 – 413
shared Optimistic Offline Lock (Java), 441 – 446
shared Pessimistic Offline Lock (Java), 446 – 447
simple database mapper (Java), 171 – 176
simple display (Java), 347 – 349
simple display with servlet controller (Java), 335 – 337
simple lock manager (Java), 431 – 437
simple null objects (C#), 498
simple person (Java), 162 – 164
simple Query Object (Java), 318 – 321
simple transform (Java), 363 – 364
simple value objects (Java), 270 – 271
single table for players (C#), 280 – 281
single-valued reference (Java), 240 – 243
singleton registry (Java), 483 – 484
state model Application Controller (Java), 382 – 386
swapping Repository strategies (Java), 326 – 327
thread-safe registry (Java), 484 – 485
transferring information about albums (Java), 407 – 411
two-stage XSLT (XSLT), 371 – 374
Unit of Work with object registration (Java), 190 –94
using ADO.NET data sets (C#), 148 – 151
using compound key (Java), 224 – 235
using direct SQL (Java), 253 – 256
using ghosts (C#), 206 –14
using Java session been as Remote Facade (Java), 392 – 395
using JSP as handler (Java), 337 – 340
using key table (Java), 222 – 224
using metadata and reflection(Java), 309 – 15
using single query for multiple employees (Java), 256 – 261
using value holder (Java), 205 – 6
virtual proxy (Java), 203 – 5
Web service (C#), 395 – 400
Execution contexts, 65 – 66
F
Facade, Remote, 388 – 400
examples
using Java session been as Remote Facade (Java), 392 – 395
Web service (C#), 395 – 400
how it works, 389 – 392
when to use it, 392
Fields, Identity, 216 – 235
examples
integral key (C#), 221 – 222
using compound key (Java), 224 – 235
using key table (Java), 222 – 224
further reading, 221
how it works, 216 – 220
when to use it, 220 – 221
Find, multitable, 243 – 244
Finders, separating, 176 – 179
Foreign Key Mapping, 236 – 247
examples
collection of references (C#), 244 – 247
multitable find (Java}, 243 – 244
single-valued reference (Java), 240 – 243
how it works, 236 – 239
when to use it, 239 – 240
Front Controller, 344 – 349
example
simple display (Java), 347 – 349
further reading, 347
how it works, 344 – 346
when to use it, 346
G
Gateway, 466 – 472
example
gateway to proprietary messaging service (Java), 468 – 472
how it works, 466 – 467
Gateway, continued
Person, 146 – 148
when to use it, 467 – 468
Gateway, Row Data, 152 – 159
examples
data holder for domain object (Java), 158 – 159
person record (Java), 155 – 158
how it works, 152 – 153
when to use it, 153 – 155
Gateway, Table Data, 144 – 151
examples
Person Gateway (C#), 146 – 148
using ADO.NET data sets (C#), 148 – 151
further reading, 146
how it works, 144 – 145
when to use it, 145 – 146
Gateway to proprietary messaging service (Java), 468 – 472
Generator, Id, 501 – 3
Ghosts, 202 , 206 –14
Globally Unique IDentifier (GUID), 219
GUID (Globally Unique IDentifier), 219
H
Handlers
page, 340 – 343
using JSP as, 337 – 340
Hierarchy, serializing department, 274 – 277
Holder, using value, 205 – 6
I
Id Generator (Java), 501 – 3
Identity Field, 216 – 235
examples
integral key (C#), 221 – 222
using compound key (Java), 224 – 235
using key table (Java), 222 – 224
further reading, 221
how it works, 216 – 220
when to use it, 220 – 221
Identity Map, 195 – 199
example
methods for Identity Map (Java), 198 – 199
how it works, 195 – 197
methods for, 198 – 199
when to use it, 198
Immutability, isolation and, 66 – 67
Immutable data, 67
Implicit Lock, 449 – 453
example
implicit Pessimistic Offline Lock (Java), 451 – 453
how it works, 450 – 451
when to use it, 451
Implicit Pessimistic Offline Lock (Java), 451 – 453
Inconsistent reads, 64
preventing, 68 – 69
Inheritance, 45 – 47
Inheritance, Class Table, 285 – 292
example
players and their kin (C#), 287 – 292
further reading, 287
how it works, 285 – 286
when to use it, 286 – 287
Inheritance, Concrete Table, 293 – 301
example
concrete players (C#), 296 – 301
how it works, 293 – 295
when to use it, 295 – 296
Inheritance Mappers, 302 – 4
how it works, 303 – 4
when to use it, 304
Inheritance, Single Table
example single table for players (C#), 280 – 281
how it works, 278 – 279
loading objects from databases, 281 – 284
when to use it, 279 – 280
Initialization, lazy, 203
Input controller patterns, 61
Integral key (C#), 221 – 222
Interfaces
for distribution, 92 – 93
remote and local, 88 – 90
Separated, 476 – 479
how it works, 477 – 478
when to use it, 478 – 479
Isolated threads, 66
Isolation
and immutability, 66 – 67
reducing transaction for liveness, 73 – 74
J
J2EE, Java and, 100 – 101
J2EE layers, core, 104
Java
albums and tracks, 264 – 267
creating empty objects, 179 – 181
data holder for domain object, 158 – 159
domain layer with Data Mappers, 421 – 425
domain objects, 475
finding person’s dependents, 325 – 326
gateway to proprietary messaging service, 468 – 472
Id Generator, 501 – 3
and J2EE, 100 – 101
JSP and custom tags, 374 – 378
methods for Identity Map, 198 – 199
money class, 491 – 495
multitable find, 243 – 244
person record, 155 – 158
revenue recognition, 113 – 15 , 120 – 124 , 138 – 141
root Optimistic Offline Lock, 447 – 448
sales tax service, 505 – 7
separating finders, 176 – 179
serializing department hierarchy in XML, 274 – 277
serializing using XML, 411 – 413
shared Optimistic Offline Lock, 441 – 446
shared Pessimistic Offline Lock, 446 – 447
simple database mapper, 171 – 176
simple display, 347 – 349
simple display with JSP view, 335 – 337
simple display with servlet controller, 335 – 337
simple person, 162 – 164
simple Query Object, 318 – 321
simple transform, 363 – 364
simple value objects, 270 – 271
single-valued reference (Java), 240 – 243
singleton registry, 483 – 484
state model Application Controller, 382 – 386
swapping Repository strategies, 326 – 327
thread-safe registry, 484 – 485
transferring information about albums, 407 – 411
Unit of Work with object registration, 190 –94
using compound key, 224 – 235
using direct SQL, 253 – 256
using Java session bean as Remote Facade, 392 – 395
using JSP as handler, 337 – 340
using JSP as view with separate controller, 355 – 357
using key table, 222 – 224
using metadata and reflection, 309 – 15
using single query for multiple employees, 256 – 261
using value holder, 205 – 6
Java session bean, using as Remote Facade (Java), 392 – 395
JSP
using as handler, 337 – 340
using as view, 355 – 357
JSP and custom tags (Java), 374 – 378
JSP view, simple display with, 335 – 337
K
Key Mapping, Foreign, 236 – 247
Key table, 222 – 224
Keys
compound, 224 – 235
integral, 221 – 222
Kin, players and their, 287 – 292
L
Late transactions, 72
Layer Supertype, 475
example
domain objects (Java), 475
how it works, 475
when to use it, 475
Layering, 17 – 24
choosing to run your layers, 22 – 24
evolution of layers in enterprise applications, 18 – 19
schemes, 103 – 6
three principal layers, 19 – 22
Layers
Brown, 104
choosing to run your, 22 – 24
core J2EE, 104
down to data source, 97 – 100
data source for Domain Models, 98 – 99
data source for Transaction Scripts, 97 – 98
data source Table Modules, 98
presentation layers, 99 – 100
Marinescu, 105
Microsoft DNA, 105
Nilsson, 106
presentation, 99 – 100
Service, 30 – 32
starting with domain, 96 – 97
three principal, 19 – 22
Layers, evolution of, 18 – 19
Layers, Service, 133 – 141
example
revenue recognition (Java), 138 – 141
further reading, 137
how it works, 134 – 137
when to use it, 137
Lazy initialization (Java), 203
Lazy Load, 200 – 214
examples
lazy initialization (Java), 203
using ghosts (C#), 206 –14
using value holder (Java), 205 – 6
virtual proxy (Java), 203 – 5
how it works, 200 – 203
when to use it, 203
Liveness, 65
reducing transactions isolation for, 73 – 74
Load, Lazy, 200 – 214
examples
lazy initialization (Java), 203
using ghosts (C#), 206 –14
using value holder (Java), 205 – 6
virtual proxy (Java), 203 – 5
how it works, 200 – 203
when to use it, 203
Loading, ripple, 202
LOBs (large objects), serialized, 272 – 277
example
serializing department hierarchy in XML (Java), 274 – 277
how it works, 272 – 273
when to use it, 274
Local interfaces, remote and, 88 – 90
Lock manager, simple, 431 – 437
Locking
optimistic, 67
pessimistic, 67
Locks
root Optimistic Offline, 447 – 448
shared Optimistic Offline, 441 – 446
shared Pessimistic Offline, 446 – 447
Locks, Coarse-Grained, 438 – 448
examples
root Optimistic Offline Lock (Java), 447 – 448
shared Optimistic Offline Lock (Java), 441 – 446
shared Pessimistic Offline Lock (Java), 446 – 447
how it works, 438 – 441
when to use it, 441
Locks, Implicit, 449 – 453
example
implicit Pessimistic Offline Lock (Java), 451 – 453
how it works, 450 – 451
when to use it, 451
Locks, implicit Pessimistic Offline, 451 – 453
Locks, Optimistic Offline, 416 – 425
example
domain layer with Data Mappers (Java), 421 – 425
how it works, 417 – 420
when to use it, 420 – 421
Locks, Pessimistic Offline, 426 – 437
example
simple lock manager (Java), 431 – 437
how it works, 427 – 431
when to use it, 431
Logic
business, 20
data source, 20
domain, 20
organizing domain, 25 – 32
making choices, 29 – 30
Service Layers, 30 – 32
presentation, 19 – 20
Logic patterns, domain, 109 – 141
Domain Model, 116 – 124
Service Layer, 133 – 141
Table Module, 125 – 132
Transaction Script, 110 – 15
Long transactions, 72
Lost updates, 64
M
Manager, simple lock, 431 – 437
Map, Identity, 195 – 199
example
methods for Identity Map (Java), 198 – 199
how it works, 195 – 197
when to use it, 198
Mapper, 473 – 474
how it works, 473
when to use it, 474
Mapper, Data, 165 – 181
examples
creating empty objects (Java), 179 – 181
separating finders (Java), 176 – 179
simple database mapper (Java), 171 – 176
how it works, 165 – 170
when to use it, 170 – 171
Mapper, simple database, 171 – 176
Mappers, domain layer with Data, 421 – 425
Mappers, Inheritance, 302 – 4
how it works, 303 – 4
when to use it, 304
Mapping, Association Table, 248 – 261
examples
employees and skills (C#), 250 – 253
using direct SQL (Java), 253 – 256
using single query for multiple employees (Java), 256 – 261
how it works, 248 – 249
when to use it, 249
Mapping, building, 47 – 49
Mapping, Dependent, 262 – 267
example
albums and tracks (Java), 264 – 267
how it works, 262 – 263
when to use it, 263 – 264
Mapping, Foreign Key, 236 – 247
examples
collection of references (C#), 244 – 247
multitable find (Java}, 243 – 244
single-valued reference (Java), 240 – 243
how it works, 236 – 239
when to use it, 239 – 240
Mapping, Metadata
example
using metadata and reflection(Java), 309 – 15
how it works, 306 – 8
when to use it, 308 – 9
Mapping patterns
object-relational metadata, 305 – 327
Metadata Mapping, 306 – 15
Query Object, 316 – 321
Repository, 322 – 327
structural, 41 – 47
inheritance, 45 – 47
mapping relationships, 41 – 45
Mapping relationships, 41 – 45
Mapping to relational databases, 33 – 53
architectural patterns, 33 – 38
behavioral problem, 38 – 39
building mapping, 47 – 49
database connections, 50 – 52
reading in data, 40 – 41
some miscellaneous points, 52 – 53
structural mapping patterns, 41 – 47
using metadata, 49 – 50
Marinescu layers, 105
Messaging service, gateway to, 468 – 472
Metadata and reflection, using, 309 – 15
Metadata Mapping, 306 – 15
example
using metadata and reflection (Java), 309 – 15
Metadata Mapping, continued
how it works, 306 – 8
when to use it, 308 – 9
Metadata mapping patterns, object-relational, 305 – 327
Metadata Mapping, 306 – 15
Query Object, 316 – 321
Repository, 322 – 327
Metadata, using, 49 – 50
Microsoft DNA layers, 105
Migration, session, 85
Model, Domain, 116 – 124
example
revenue recognition (Java), 120 – 124
further reading, 119 – 120
how it works, 116 – 119
when to use it, 119
Model View Controller (MVC), 330 – 332
Models, data source for Domain, 98 – 99
Modules, data source Table, 98
Modules, Table, 125 – 132
example
revenue recognition with Table Module (C#), 129 – 132
how it works, 126 – 128
when to use it, 128
Money, 488 – 495
example
money class (Java), 491 – 495
how it works, 488 – 490
when to use it, 490 – 491
Money class (Java), 491 – 495
Multiple employees, using single query for, 256 – 261
Multitable find (Java), 243 – 244
MVC (Model View Controller), 330 – 332
how it works, 330 – 332
when to use it, 332
N
.NET, 101 – 2
Nilsson layers, 106
Null objects, simple, 498
O
Object registration, 186
Object registration, Unit of Work with, 190 –94
Object-relational behavioral patterns, 183 – 214
Identity Map, 195 – 199
Lazy Load, 200 – 214
Unit of Work, 184 –94
Object-relational metadata mapping patterns, 305 – 327
Metadata Mapping, 306 – 15
Query Object, 316 – 321
Repository, 322 – 327
Object-relational structural patterns, 215 – 284
Association Table Mapping, 248 – 261
Class Table Inheritance, 285 – 292
Concrete Table Inheritance, 293 – 301
Dependent Mapping, 262 – 267
Embedded Value, 268 – 271
Foreign Key Mapping, 236 – 247
Identity Field, 216 – 235
Inheritance Mappers, 302 – 4
serialized LOBs (large objects), 272 – 277
Single Table Inheritance, 278 – 284
Object, simple Query, 318 – 321
Objects
allure of distributed, 87 – 88
creating empty, 179 – 181
domain, 475
loading from databases, 281 – 284
simple null, 498
simple value, 270 – 271
Objects, Data Transfer, 401 – 413
examples
serializing using XML (Java), 411 – 413
transferring information about albums (Java), 407 – 411
further reading, 407
how it works, 401 – 6
when to use it, 406
Objects, Query, 316 – 321
example
simple Query Object (Java), 318 – 321
further reading, 318
how it works, 316 – 317
when to use it, 317 – 318
Objects, Value, 486 – 487
how it works, 486 – 487
when to use it, 487
Offline concurrency, 63 , 75
Offline concurrency control, patterns for, 76 – 78
Offline concurrency patterns, 415 – 453
Coarse-Grained Lock, 438 – 448
Implicit Lock, 449 – 453
Optimistic Offline Lock, 416 – 425
Pessimistic Offline Lock, 426 – 437
Offline Lock, implicit Pessimistic, 451 – 453
Offline Lock, Optimistic, 416 – 425
example
domain layer with Data Mappers (Java), 421 – 425
how it works, 417 – 420
when to use it, 420 – 421
Offline Lock, Pessimistic, 426 – 437
example
simple lock manager (Java), 431 – 437
how it works, 427 – 431
when to use it, 431
Offline Lock, root Optimistic, 447 – 448
Offline Lock, shared Optimistic, 441 – 446
Offline Lock, shared Pessimistic, 446 – 447
Optimistic and pessimistic concurrency controls, 67 – 71
Optimistic locking, 67
Optimistic Offline Lock, 416 – 425
example
domain layer with Data Mappers (Java), 421 – 425
how it works, 417 – 420
root, 447 – 448
shared, 441 – 446
when to use it, 420 – 421
P
Page Controller, 333 – 343
examples
page handler with code behind (C#), 340 – 343
simple display with JSP view (Java), 335 – 337
simple display with servlet controller (Java), 335 – 337
using JSP as handler (Java), 337 – 340
how it works, 333 – 334
when to use it, 334 – 335
Page handler with code behind, 340 – 343
Patterns
architectural, 33 – 38
base, 465 – 510
Gateway, 466 – 472
Layer Supertype, 475
Mapper, 473 – 474
Money, 488 – 495
Plugin, 499 – 503
Record Set, 508 – 510
Registry, 480 – 485
Separated Interface, 476 – 479
Service Stub, 504 – 7
Special Case, 496 – 498
Value Object, 486 – 487
data source architectural, 143 – 181
Active Record, 160 – 164
Data Mapper, 165 – 181
Row Data Gateway, 152 – 159
Table Data Gateway, 144 – 151
distribution, 387 – 413
Data Transfer Objects, 401 – 413
Remote Facade, 388 – 400
domain logic, 109 – 141
input controller, 61
mapping structural, 41 – 47
inheritance, 45 – 47
mapping relationships, 41 – 45
object-relational behavioral, 183 – 214
Identity Map, 195 – 199
Lazy Load, 200 – 214
Unit of Work, 184 –94
object-relational metadata mapping, 305 – 327
Metadata Mapping, 306 – 15
Query Object, 316 – 321
Repository, 322 – 327
object-relational structural, 215 – 284
Association Table Mapping, 248 – 261
Class Table Inheritance, 285 – 292
Concrete Table Inheritance, 293 – 301
Dependent Mapping, 262 – 267
Embedded Value, 268 – 271
Foreign Key Mapping, 236 – 247
Identity Field, 216 – 235
Inheritance Mappers, 302 – 4
Serialized LOBs (large objects), 272 – 277
Single Table Inheritance, 278 – 284
Patterns, continued
offline concurrency, 415 – 453
Coarse-Grained Lock, 438 – 448
Implicit Lock, 449 – 453
Optimistic Offline Lock, 416 – 425
Pessimistic Offline Lock, 426 – 437
session state, 455 – 464
Client Session State, 456 – 457
Database Session State, 462 – 464
Server Session State, 458 – 461
view, 58 – 60
Web presentation, 329 – 386
Application Controller, 379 – 386
Front Controller, 344 – 349
MVC (Model View Controller), 330 – 332
Page Controller, 333 – 343
Template View, 350 – 360
Transform View, 361 – 364
Two Step View, 365 – 378
Person Gateway (C#), 146 – 148
Person record (Java), 155 – 158
Person, simple, 162 – 164
Person’s dependents, finding, 325 – 326
Pessimistic concurrency controls, optimistic and, 67 – 71
Pessimistic locking, 67
Pessimistic Offline Lock, 426 – 437
example
simple lock manager (Java), 431 – 437
how it works, 427 – 431
implicit, 451 – 453
shared, 446 – 447
when to use it, 431
Phantoms, 73
Plain old Java objects (POJOs), 392
Players
concrete, 296 – 301
single table for, 280 – 281
Players and their kin (C#), 287 – 292
Plugin, 499 – 503
example
Id Generator (Java), 501 – 3
how it works, 499 – 500
when to use it, 500
POJOs (plain old Java objects), 392
Presentation
layers, 99 – 100
logic, 19 – 20
Web, 55 – 61
Presentation patterns, Web, 329 – 386
Application Controller, 379 – 386
Front Controller, 344 – 349
MVC (Model View Controller), 330 – 332
Page Controller, 333 – 343
Template View, 350 – 360
Transform View, 361 – 364
Two Step View, 365 – 378
Problems
behavioral, 38 – 39
concurrency, 64 – 65
Procedures, stored, 102 – 3
Process-per-request, 78
Process-per-session, 78
Processes defined, 66
Proxy, virtual, 203 – 5
Putting it all together, 95 – 106
down to data source layers, 97 – 100
miscellaneous layering schemes, 103 – 6
some technology-specific advice, 100 – 103
starting with domain layers, 96 – 97
Q
Query Object, 316 – 321
example
simple Query Object (Java), 318 – 321
further reading, 318
how it works, 316 – 317
when to use it, 317 – 318
Query Object, simple, 318 – 321
Query, using single, 256 – 261
R
Read
inconsistent, 64
repeatable, 73
Read committed, 73
Read uncommitted, 74
Reads
dirty, 74
preventing inconsistent, 68 – 69
Temporal, 69
unrepeatable, 73
Record data, 83
Record Set, 508 – 510
how it works, 508 – 510
when to use it, 510
Records, Active, 160 – 164
example
simple person (Java), 162 – 164
how it works, 160 – 161
when to use it, 161 –62
References
collection of, 244 – 247
single-valued, 240 – 243
Reflection, using metadata and, 309 – 15
Registration
object, 186
Unit of Work with object, 190 –94
Registry, 480 – 485
examples
singleton registry (Java), 483 – 484
thread-safe registry (Java), 484 – 485
how it works, 480 – 482
singleton, 483 – 484
thread-safe, 484 – 485
when to use it, 482 – 483
Relational databases, mapping to, 33 – 53
architectural patterns, 33 – 38
behavioral problem, 38 – 39
building mapping, 47 – 49
database connections, 50 – 52
reading in data, 40 – 41
some miscellaneous points, 52 – 53
structural mapping patterns, 41 – 47
using metadata, 49 – 50
Relationships, mapping, 41 – 45
Remote and local interfaces, 88 – 90
Remote Facade, 388 – 400
examples
using Java session been as Remote Facade (Java), 392 – 395
Web service (C#), 395 – 400
how it works, 389 – 392
when to use it, 392
Remote Facade, using Java session bean as, 392 – 395
Repeatable read, 73
Repository, 322 – 327
examples
finding person’s dependents (Java), 325 – 326
swapping Repository strategies (Java), 326 – 327
further reading, 325
how it works, 323 – 324
when to use it, 324 – 325
Repository strategies, swapping, 326 – 327
Request transactions, 72
Requests, 65
Resources, transactional, 72 – 73
Revenue recognition (Java), 113 – 15 , 120 – 124
Revenue recognition problem, 112 – 113
Revenue recognition with Table Module (C#), 129 – 132
Ripple loading, 202
Root Optimistic Offline Lock (Java), 447 – 448
Row Data Gateway, 152 – 159
examples
data holder for domain object (Java), 158 – 159
person record (Java), 155 – 158
how it works, 152 – 153
when to use it, 153 – 155
S
Safety, 65
Sales tax service (Java), 505 – 7
Schemes, miscellaneous layering, 103 – 6
SCM (source code management), 420
Scripts, data source for Transaction, 97 – 98
Scripts, Transaction, 110 – 15
example
revenue recognition (Java), 113 – 15
how it works, 110 – 111
revenue recognition problem, 112 – 113
when to use it, 111 – 112
Separate controller, using JSP as view with, 355 – 357
Separated Interface, 476 – 479
how it works, 477 – 478
when to use it, 478 – 479
Serializable, transactions are, 73
Serialized LOBs (large objects), 272 – 277
example
serializing department hierarchy in XML (Java), 274 – 277
how it works, 272 – 273
when to use it, 274
Serializing using XML (Java), 411 – 413
Server affinity, 85
Server concurrency, application, 78 – 80
Server page, ASP.NET, 357 – 360
Server Session State, 458 – 461
how it works, 458 – 460
when to use it, 460 – 461
Servers, stateless, 81
Service Layer, 30 – 32 , 133 – 141
example
revenue recognition (Java), 138 – 141
further reading, 137
how it works, 134 – 137
when to use it, 137
Service Stub, 504 – 7
example
sales tax service (Java), 505 – 7
how it works, 504 – 5
when to use it, 505
Services, gateway to proprietary messaging, 468 – 472
Services, Web, 103 , 395 – 400
Servlet controller, simple display with, 335 – 337
Session migration, 85
Session state, 81 , 83 – 86
Session State
Client, 456 – 457
how it works, 456 – 457
when to use it, 457
Database, 462 – 464
how it works, 462 – 463
when to use it, 464
Server, 458 – 461
how it works, 458 – 460
when to use it, 460 – 461
Session state
value of statelessness, 81 – 83
ways to store, 84 – 86
ways to store session state, 84 – 86
Session state patterns, 455 – 464
Client Session State, 456 – 457
Database Session State, 462 – 464
Server Session State, 458 – 461
Sessions defined, 66
Shared Optimistic Offline Lock (Java), 441 – 446
Shared Pessimistic Offline Lock (Java), 446 – 447
Simple display (Java), 347 – 349
Simple person (Java), 162 – 164
Simple transform (Java), 363 – 364
Single Table Inheritance
example
single table for players (C#), 280 – 281
how it works, 278 – 279
loading objects from databases, 281 – 284
when to use it, 279 – 280
Singleton registry (Java), 483 – 484
Skills, employees and, 250 – 253
Source code management (SCM), 420
Source layers, down to data, 97 – 100
Special Case, 496 – 498
example
simple null objects (C#), 498
further reading, 497
how it works, 497
when to use it, 497
SQL, using direct, 253 – 256
State
session, 81 , 83 – 86
ways to store session, 84 – 86
State model Application Controller (Java), 382 – 386
Stateless servers, 81
Stored procedures, 102 – 3
Strategies
distribution, 87 – 93
allure of distributed objects, 87 – 88
interfaces for distribution, 92 – 93
remote and local interfaces, 88 – 90
where you have to distribute, 90 – 91
working with distribution boundaries, 91 – 92
swapping Repository, 326 – 327
Structural mapping patterns., 41 – 47
inheritance, 45 – 47
mapping relationships, 41 – 45
Structural patterns, object-relational, 215 – 284
Association Table Mapping, 248 – 261
Class Table Inheritance, 285 – 292
Concrete Table Inheritance, 293 – 301
Dependent Mapping, 262 – 267
Embedded Value, 268 – 271
Foreign Key Mapping, 236 – 247
Identity Field, 216 – 235
Inheritance Mappers, 302 – 4
serialized LOBs (large objects), 272 – 277
Single Table Inheritance, 278 – 284
Stub, Service, 504 – 7
example
sales tax service (Java), 505 – 7
how it works, 504 – 5
when to use it, 505
System transactions, business and, 74 – 76
T
Table Data Gateway, 144 – 151
examples
Person Gateway (C#), 146 – 148
using ADO.NET data sets (C#), 148 – 151
further reading, 146
how it works, 144 – 145
when to use it, 145 – 146
Table Inheritance, Class, 285 – 292
Table Inheritance, Concrete, 293 – 301
example
concrete players (C#), 296 – 301
how it works, 293 – 295
when to use it, 295 – 296
Table Inheritance, Single
example
single table for players (C#), 280 – 281
how it works, 278 – 279
loading objects from databases, 281 – 284
when to use it, 279 – 280
Table Mapping, Association, 248 – 261
examples
employees and skills (C#), 250 – 253
using direct SQL (Java), 253 – 256
using single query for multiple employees (Java), 256 – 261
how it works, 248 – 249
when to use it, 249
Table Modules, 125 – 132
data source, 98
example
revenue recognition with Table Module (C#), 129 – 132
how it works, 126 – 128
when to use it, 128
Tables, key, 222 – 224
Tags, JSP and custom, 374 – 378
Tax service, sales, 505 – 7
Technology-specific advice, some, 100 – 103
Java and J2EE, 100 – 101
.NET, 101 – 2
stored procedures, 102 – 3
Web services, 103
Template View, 350 – 360
examples
ASP.NET server page (C#), 357 – 360
using JSP as view with separate controller (Java), 355 – 357
how it works, 351 –54
when to use it, 354 – 355
Temporal Reads, 69
Thread-safe registry (Java), 484 – 485
Threads
defined, 66
isolated, 66
Together, putting it all, 95 – 106
down to data source layers, 97 – 100
miscellaneous layering schemes, 103 – 6
some technology-specific advice, 100 – 103
starting with domain layers, 96 – 97
Tracks, albums and, 264 – 267
Transaction isolation, reducing for liveness, 73 – 74
Transaction Script, 110 – 15
example
revenue recognition (Java), 113 – 15
how it works, 110 – 111
revenue recognition problem, 112 – 113
when to use it, 111 – 112
Transaction Scripts, data source for, 97 – 98
Transactional resources, 72 – 73
Transactions, 66 , 71
business and system, 74 – 76
late, 72
long, 72
request, 72
system, 74 – 76
Transform, simple, 363 – 364
Transform View, 361 – 364
example
simple transform (Java), 363 – 364
when to use it, 362 – 363
Two-stage XSLT (XSLT), 371 – 374
Two Step View, 365 – 378
examples
JSP and custom tags (Java), 374 – 378
two-stage XSLT (XSLT), 371 – 374
how it works, 365 – 367
when to use it, 367 – 371
U
Uncommitted, read, 74
Unit of Work, 184 –94
example
Unit of Work with object registration (Java), 190 –94
how it works, 184 – 189
when to use it, 189 – 190
Unit of Work with object registration (Java), 190 –94
Unrepeatable reads, 73
Updates, lost, 64
V
Value holder, using, 205 – 6
Value Object, 486 – 487
how it works, 486 – 487
when to use it, 487
Value objects, simple, 270 – 271
Values, Embedded, 268 – 271
example
simple value objects (Java), 270 – 271
further reading, 270
how it works, 268
when to use it, 268 – 269
View patterns, 58 – 60
View, simple display with JSP, 335 – 337
Views, Template, 350 – 360
examples
ASP.NET server page (C#), 357 – 360
using JSP as view with separate controller (Java), 355 – 357
how it works, 351 –54
when to use it, 354 – 355
Views, Transform, 361 – 364
example
simple transform (Java), 363 – 364
how it works, 361 –62
when to use it, 362 – 363
Views, Two Step, 365 – 378
examples
JSP and custom tags (Java), 374 – 378
two-stage XSLT (XSLT), 371 – 374
how it works, 365 – 367
when to use it, 367 – 371
Virtual proxy (Java), 203 – 5
W
Web presentation, 55 – 61
input controller patterns, 61
view patterns, 58 – 60
Web presentation patterns, 329 – 386
Application Controller, 379 – 386
Front Controller, 344 – 349
MVC (Model View Controller), 330 – 332
Page Controller, 333 – 343
Template View, 350 – 360
Transform View, 361 – 364
Two Step View, 365 – 378
Web service (C#), 395 – 400
Web services, 103
Work, Unit of, 184 –94
example
Unit of Work with object registration (Java), 190 –94
how it works, 184 – 189
when to use it, 189 – 190
X
XML
serializing department hierarchy in, 274 – 277
serializing using, 411 – 413
XSLT, two stage, 371 – 374