Database Reference
In-Depth Information
It's worth being aware that use of the advanced mapping mode will generally involve a
read-through down to the database whenever a property or relationship is accessed on the
domain entity. To avoid multiple DB reads it may sometimes make sense to store data, or
interim results, or both, in local variables rather than repeatedly querying for the data via
the domain entity itself. Depending on how you're interacting with the entity, this local
variable could be scoped to within a method, within the entity class itself, or even with-
in another class. This will aid performance, but additional variables will also add to your
overall memory footprint, so you need to keep this in mind.
What if I'm operating within an existing transaction?
If you have previously created or started an explicit transaction before your code executes
(as opposed to relying on implicit transactions), SDN will not try to create its own new
transaction. SDN will simply operate within the existing transaction boundary established,
providing you with the ability to make use of all the standard transaction controls (such as
rollback) that you're typically accustomed to.
This concludes our brief overview of the advanced mapping mode. In exchange for some
configurationheadachesasyousetupAspectJforyourdevelopmentenvironment(thiswas
one of the primary complaints that led to the introduction of the simple mapping mode),
you can better utilize your available memory compared to the simple approach, though
there may be performance penalties for property read-throughs if you don't deal with them
appropriately.
9.4.3. Object mapping summary
Table 9.1 compares the simple and advanced mapping modes.
Table 9.1. Comparison of simple and advanced mapping modes
Advantages
Disadvantages
Can be memory-hungry, with data
copied backward and forward between
the entity and node representation.
Simple and intuitive to understand,
works out of the box.
Simple mapping mode
No special IDE requirements.
Slower.
 
Search WWH ::




Custom Search