Posts

Showing posts with the label P of EAA

Class Table Inheritance Pattern

Image
This pattern belongs to  Object-Relational Structural Patterns  Catalog and this Catalog belongs to  Patterns of Enterprise Application Architecture . Intent Represents an inheritance hierarchy of classes with one table for each class. Class Table Inheritance supports one database table per class in the inheritance structure. Explanation Please note in the diagram, each class have their own database table. Player class have its own players database table. Cricketer class have its own cricketers  database table. Footballer class have its own footballers database table. Bowler class has its own bowlers  database table. How It Works The straightforward thing about Class Table Inheritance is that it has one table per class in the domain model. The fields in the domain class map directly to fields in the corresponding tables. As with the other inheritance mappings the fundamental approach of Inheritance Mappers (302) applies. The biggest impleme...

Single Table Inheritance Pattern

Image
This pattern belongs to  Object-Relational Structural Patterns  Catalog and this Catalog belongs to  Patterns of Enterprise Application Architecture . Intent Represents an inheritance hierarchy of classes as a single table that has columns for all the fields of the various classes. Single Table Inheritance maps all fields of all classes of an inheritance structure into a single table. Explanation Relational databases don�t support inheritance, so when mapping from objects to databases we have to consider how to represent our nice inheritance structures in relational tables. When mapping to a relational database, we try to minimize the joins that can quickly mount up when processing an inheritance structure in multiple tables. Single Table Inheritance maps all fields of all classes of an inheritance structure into a single table. From above diagram,  Player is the parent abstract class with common fields name. Footballer and Cricketer are also player...

Association Table Mapping Pattern

Image
This pattern belongs to  Object-Relational Structural Patterns  Catalog and this Catalog belongs to  Patterns of Enterprise Application Architecture . Intent Saves an association as a table with foreign keys to the tables that are linked by the association (This is a many-to-many relationship). Explanation A many-to-many relationship occurs when multiple records in a table are associated with multiple records in another table. For example, a many-to-many relationship exists between employees and skills : an employee can have multiple skills, and skill can be associated with many employees. One more example is, a many-to-many relationship exists between customers and products : customers can purchase various products, and products can be purchased by many customers.   The primary key Skill ID uniquely identifies each skill in the skills table. The primary key Employee ID uniquely identifies each employee in the Employees table. The skill-employees tab...