| Programming | Software Engineering | Web Design | Database | Operating Systems

Identity Map

martin fowler
Keywords: Identity,Map
From: http://martinfowler.com/eaaCatalog/identityMap.html

Ensures that each object gets loaded only once by keeping every loaded object in a map. Looks up objects using the map when referring to them.

For a full description see Patterns of Enterprise Application Architecture page 195

An old proverb says that a man with two watches never knows what time it is. If two watches are confusing, you can get in an even bigger mess with loading objects from a database. If you aren't careful you can load the data from the same database record into two different objects. Then, when you update them both you'll have an interesting time writing the changes out to the database correctly.

Related to this is an obvious performance problem. If you load the same data more than once you're incurring an expensive cost in remote calls. Thus, not loading the same data twice doesn't just help correctness, but can also speed up your application.

An Identity Map keeps a record of all objects that have been read from the database in a single business transaction. Whenever you want an object, you check the Identity Map first to see if you already have it.


Related Article
  • Association Table Mapping
  • Foreign Key Mapping
  • Identity Field
  • Data Mapper

  • Comment
    antihistamines Post At: 2006-3-9 14:53:17
    Very good map: http://arhusa.net/map0.html
    buy lady viagra Post At: 2006-3-9 14:55:52
    Very good map: http://watsonalgas.com/map0.html
    lisinopril Post At: 2006-3-9 15:30:28
    Very good map: http://arhusa.us/map0.html
    united health care medical insurance Post At: 2006-3-9 15:38:19
    Very good map: http://depharm.com/map0.html
    bwHznuxw Post At: 2008-8-18 10:19:57
    P4jKHj
    Add Your Comment:
    Your Name:      
    Your Comment:
    Note: After you post comment,please refresh the browser to show you comment.
    Search In YeYan.CN:
     

    Home | Privacy Policy | Copyright Policy | Contact Us | Site Map
    Copyright © 2006 YeYan.CN, All Rights Reserved.