Class DataManager

java.lang.Object
de.calamanari.pk.identitymap.DataManager

public final class DataManager
extends java.lang.Object
Data Manager - provides finder methods in this example, placeholder for whatever persistence framework/strategies may be in use.
If DAOs come into play, you would have to decide where to place the calls to the identity map. On the one hand logically the lookup belongs ON TOP of the DAO layer, introducing an extra layer (yuck!).
On the other hand INSIDE DAO would be convenient to reduce lines of code.
But with different DAOs (for XML, Oracle, MySQL), which is the primary reason for implementing a DAO-layer, the identity map lookup code inside the DAO would have to be duplicated (yuck! again).
One solution to this dilemma could be an abstract DAO base class containing a generic identity map lookup procedure.
Author:
Karl Eilebrecht
  • Method Summary

    Modifier and Type Method Description
    static AddressEntity findAddressById​(java.lang.String addressId)
    Finder method for addresses
    static CustomerEntity findCustomerById​(java.lang.String customerId)
    Customer finder method

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • findCustomerById

      public static CustomerEntity findCustomerById​(java.lang.String customerId)
      Customer finder method
      Parameters:
      customerId - identifier
      Returns:
      customer entity or null if not found
    • findAddressById

      public static AddressEntity findAddressById​(java.lang.String addressId)
      Finder method for addresses
      Parameters:
      addressId - identifier
      Returns:
      address entity or null if not found