Auto-incrementing Lazy loading caching cascading
Posted on 2011-05-06
I was reading folowing lines and I did not understand clearly.
When you insert a row in the database, you typically assign it a primary key that
uniquely identifies that row. It is good practice to use a surrogate key for your primary
key. That is, the primary key should have no business meaning but is instead
generated within your application. Spring provides a means to do this via the
DataFieldMaxValueIncrementer interface. This interface has three different methods
for obtaining the next value to be used as a key: nextIntValue(), next-
LongValue(), and nextStringValue().
We would use a DataFieldMaxValueIncrementer like this:
We can then wire in an implementation of this interface. Spring comes with
implementations that hook into the sequence mechanism for Oracle, Postgre-
SQL, MySQL, and Hypersonic databases. You are free to write your own implementation
Lazy loading—As our object graphs become more complex, we sometimes
don’t want to fetch entire relationships immediately. To use a typical example,
suppose we are selecting a collection of PurchaseOrder objects, and
each of these objects contains a collection of LineItem objects. If we are
only interested in PurchaseOrder attributes, it makes no sense to grab the
LineItem data. This could be quite expensive. Lazy loading allows us to
grab data only as it is needed.
i was not clear on caching, cascading as well. Which one we have to use where and advantage and disadvanate of using them
Any ideas, resources,sample code,links, highly appreciated. thanks in advance.