1 / 13

Mapping to Relational Databases

Mapping to Relational Databases. Presented by Ramona Su. Overview. Role of the database DB plays dominant role in the data source layers for most systems Storing persistent data Maintain internal records Core part of some scientific investigation What is object-relational mapping?

evers
Download Presentation

Mapping to Relational Databases

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mapping to Relational Databases Presented by Ramona Su

  2. Overview • Role of the database • DB plays dominant role in the data source layers for most systems • Storing persistent data • Maintain internal records • Core part of some scientific investigation • What is object-relational mapping? • Object-relational mapping is used to map object-oriented programming objects to relational databases managed by relational database managers. (http://www.service-architecture.com/object-relational-mapping/)

  3. Overview • Why is object-relational mapping important? • Many systems use a relational DB • SQL has helped make a relational DB successful • Better understood & proven technology over OO DB • Data already exists in a relational DB • Technical or political reasons for using a relational DB • Creating an abstraction • Takes advantage of transparent persistence • Reduces code • Improves performance

  4. Types of Databases • Object Oriented DB • Users can define their own methods of access to data and how it is represented and manipulated • Database objects appear as programming language objects in one or more object programming languages • No problem of O/R Mapping • Improves productivity • Relational DB • Ted Codd’s paper “A Relational Model for Large Shared Data Banks” • “It provides a means of describing data with its natural structure only--that is, without superimposing any additional structure for machine representation purposes. Accordingly, it provides a basis for a high level data language which will yield maximal independence between programs on the one hand and machine representation on the other.” (Codd, 1970)

  5. Architectural Patterns • Important part of design • Types of patterns • Gateway (separating access to DB) • Row Data Gateway • Record Set • Domain Model (incorporates data and behavior) • Active Record • Data Mapper (insulate domain objects and DB from each other)

  6. Loading/Saving Problem • Problem with consistency • Problem with isolated reads • Solutions • Unit of Work • Possible performance degradation • Identity Map • Performance boost • Lazy Load • Performance boost

  7. Structural Problem • Mapping relationships problems • Difference in representation • Multiple references and links • Many-to-many relationship • Solutions • Identity Field • Foreign Key Mapping • Association Table Mapping

  8. Structural Problem Continued • Inheritance • SQL cannot handle inheritance • Solutions • Single Table Inheritance • Concrete Table Inheritance • Class Table Inheritance • Tradeoff between duplication of data and speed of access

  9. Structural Problem Continued

  10. Connection Problem • Ensuring connection is opened when it needs to be, or closed when you’re done accessing • Managing connection solutions • Pass it as a parameter • Garbage collection • Tie it to a transaction • Connection can cause concurrency issues

  11. Metadata • Use metafile for mapping • Avoids repetitive code • Can build queries in terms of objects • Query Object • Repository

  12. Discussion • It seems like you must do a lot more work with O/R mapping than if you used a OO DB. How can we make use of OO DB more successful?

  13. Questions? • Any questions or comments?

More Related