Object-relational mapping Author: Jaroslav Orság Diploma thesis supervisor: Ing. Augustín Mrázik
Goal of Thesis Analysis of OOP principles, which should be supported by ORM frameworks Analyze some of the most important ORM frameworks (free, commercial) Compare reviewed frameworks Brief qualified overview of ORM for developers and IT managers
Contents The Problem Kinds of Cooperation Patterns Analisis of Frameworks –Frameworks –Criteria Conclusion
The Problem (1) OOP Encapsulation Inheritance Polymorphism Class, Instance
The Problem (2) RDBMS Tables Views Stored Procedures Relations
The Problem (3) 2 different worlds (different paradigms) Different data representation Different data manipulation Different modeling techniques Semantic gap Impedance mismatch Problem appears in huge software projects with lots of entities
The Problem (4) Typical EIS Typical architecture of today’s information system
Kinds of cooperation (1) HTML + ASP + MS SQL (Example 1) –SQL statements in ASP(JScript, VB) code –Working with tuples (records) in ASP environment –Code is ugly –Sufficient for small projects
Kinds of cooperation (2).NET + MS SQL (Example 2) –Instruments for more sophisticated data manipulation (.net DataSets, DataTables) –It is possible (more simple) to create kind of own specific mapper –This mapper is not reusable –Java + JDBC + Oracle
Kinds of cooperation (3).NET + ORM + MS SQL (Example 3) –Reusable ORM mapper is used –Object model is created and appropriate relational model is created and maintained by mapper
Mapping Approaches Do It Yourself (Example 1 & 2) Free or commercial software (Example 2 & 3) Approaches used by 3 rd party tools (mappers) –Entity approach Data are just data - use of objects without behavior Special classes for changing state of objects (objects are parameters of static methods of so-called management classes) Since ’70-ies –Domain model approach No management classes Persistent objects contains behavior Possible use of polymorphism to override behavior True ORM mappers
Patterns (1) Mapping of inheritance –One inheritance tree – one table
Patterns (2) Mapping of inheritance –One class – one table
Patterns (3) Mapping of inheritance –One concrete class – one table
Patterns (4) Mapping of inheritance –Generic table structure
Patterns (5) Mapping of aggregation –Single table aggregation
Patterns (6) Mapping of aggregation –Foreign key aggregation
Performance Caching Lazy loading Delayed updates
Configuration Attribute-oriented programming Configuration files
Analysis of Frameworks DataObjects.NET Hibernate TopLink LLBLGenPro Java Data Object (JDO)
Analysis Aspects Architecture Criteria –Transparency –Documentation & support –Dependencies, supported platforms, portability –Maintainability of model –Usability –Configuration vs. automation –Constraints on design of object model
Framework Overview
Conclusion Work brings orientation within given topic and can serve as a guide when deciding which framework to use Evaluation presented in this work cannot be considered to be general for any purpose / problem ("one size fits all...") Different frameworks are designed for different situations Results of this work can serve as a guide for evaluation of frameworks for a particular development project
Odpovede (1) Kompilačná práca
Odpovede (2) “Autor vychádza najmä z troch prác, pričom štruktúra textu (kapitoly a podkapitoly) spracovaného textu nápadne pripominajú jeden z citovaných zdrojov.”
Odpovede (3) “Kvalita grafického spracovania príkladov/obrázkov nezodpovedá zvyšku práce, a v čitateľovi podobne vzbudzuje pochybnosti o ich pôvode.”
Odpovede (4) Porovnanie frameworkov a kritériá
Odpovede (5) Anglický jazyk
Odpovede (6) Použitá literatúra, zdroje
Questions …