DESIGNING A PERSISTENCE FRAMEWORKWITH PATTERNS
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS
The Problem: persistent obiects ● persistent object o An object that can survive the process or thread that created it. a persistent object exists until it is explicitly deleted e ProductDescription e Storage Mechanisms and persistent Objects Object databases Relational databases ● others
The Problem: Persistent Objects persistent object ⚫ An object that can survive the process or thread that created it. A persistent object exists until it is explicitly deleted ProductDescription Storage Mechanisms and Persistent Objects ⚫ Object databases ⚫ Relational databases ⚫ others
The Solution A Persistence service from a persistence framework The framework should provide functions such as store and retrieve objects in a persistent storage mechanism ● commit and ro∥ back transactions
The Solution: A Persistence Service from a Persistence Framework The framework should provide functions such as: ⚫ store and retrieve objects in a persistent storage mechanism ⚫ commit and rollback transactions
e persistence framework o general-purpose, reusable, and extendable set of types that provides functionality to support persistent objects ● framework o a set of collaborating abstract and concrete classes that may be used as a template to solve a related family of problems. It is usually extended via subclassing for application-specific behavior
persistence framework ⚫ general-purpose, reusable, and extendable set of types that provides functionality to support persistent objects framework ⚫ A set of collaborating abstract and concrete classes that may be used as a template to solve a related family of problems. It is usually extended via subclassing for application-specific behavior
Key Ideas e Mapping .Object identity Database mapper e Materialization and dematerialization e Caches Transaction state of object e Transaction operations e Lazy materialization vIrtual proxies
Key Ideas Mapping Object identity Database mapper Materialization and dematerialization Caches Transaction state of object Transaction operations Lazy materialization Virtual proxies
he Representing objects as Tables pattern How do you map an object to a record or relational database schema? e The Representing objects as Tables pattern
The Representing Objects as Tables pattern How do you map an object to a record or relational database schema? The Representing Objects as Tables pattern
Manufacturer MANUFACTURER TABLE Manufacturer name= Now&Zen name name cit city Mumbai Now &Zen Mumbai Celestial Shortening San Ramon
Manufacturer name city ... ... name city Now&Zen Mumbai MANUFACTURER TABLE : Manufacturer name = Now&Zen city = Mumbai Celestial Shortening San Ramon
UML Data Modeling Profile aggregate signifies a referential constraint: a ProductDescription row can t exist without a related Manufacturer row OlD: char(16) Name: varchar(100 Description: varchar (100) City: varchar (50) PK-primary key FK-foreign key Manu_ OID: char(16)
UML Data Modeling Profile «Table» ProductDescription «PK» OID : char(16) Description : varchar(100) ... «FK» Manu_OID : char(16) «Table» Manufacturer «PK» OID : char(16) Name : varchar(100) City : varchar(50) 1 * aggregate signifies a referential constraint: a ProductDescription row can't exist without a related Manufacturer row PK - primary key FK - foreign key
对关系的存储设计 将一对一关联映射到表。 两个需要存储的永久类,二者之间有一个一对一关联。 职员 与;一 办公室 职员号码 办公室名 名字 地点
对关系的存储设计