Object Relational Mapping (ORM) is a technique for mapping objects to the relational database. This report discusses the problems of object relational mismatch, benefits and limitations of ORM, and technologies of ORM. It also compares ORM with traditional data access techniques.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
Running head:OBJECT RELATIONAL MAPPING Object Relational Mapping Name of the Student Name of the University Author note
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
1 OBJECT RELATIONAL MAPPING Table of Contents Introduction:...............................................................................................................................2 Discussion:.................................................................................................................................2 Object relational mismatch:...................................................................................................2 Granularity problem:..........................................................................................................3 Issue of Inheritance mismatch:...........................................................................................3 Identity mismatch:..............................................................................................................3 Problem in Association......................................................................................................3 Navigation problem............................................................................................................4 Comparison of ORM with traditional data access techniques:..............................................4 Benefits of Object Relational Mapping:................................................................................4 Limitations and drawbacks of ORM:.....................................................................................5 Description of ORM technologies:............................................................................................5 Java persistence API:.............................................................................................................5 Language Integrated Query:...................................................................................................6 Hibernate Object Relational Mapping...................................................................................6 RedBeanPHP:.........................................................................................................................6 Conclusion:................................................................................................................................7 References:.................................................................................................................................8
2 OBJECT RELATIONAL MAPPING Introduction: Object Relational Mapping (ORM) can be defined as a technique in computer programming system that isimplemented for connecting or mappingobjects to the relational database.ItresolvesthedatatypemismatchissuebetweentheObjectOriented Programmings (OOPs) and the relational database. It performs as a medium for the data conversion between object oriented programming languages and relational database (Correa, Wang and Zimanyi 2017). In Object Oriented Programming, data are saved in the form of objects, however in the database, data are saved in the form of simple values, therefore ORM acts as a tool for the conversion of these objects into simple values to store it in the database without losing its properties. The following paragraphs give an introduction about the problems of object relational mismatch. The report highlights the benefits and limitations of implementing object relational mapping. The report also gives a description about the technologies of the object relational mapping. Discussion: Object relational mismatch: Object relational mismatch is described as a condition that arises during the mapping or conversion of a class or object into database tables or relational database. The object oriented programming languages and relational database have their own data types, therefore a mismatch in data types occur while mapping object values to the relational model. The data in Object Oriented Programming are stored in the form of non-scalar values, however the data in database tables are specific and scalar values, therefore there occurs a mismatch or trouble while converting the Object Oriented data into relational database. Therefore, Object relational mismatch can be considered as the problem that is encountered during using a relational database for storing a set of objects from a program or software written in Object Oriented Programming language. The different types of mismatch problems that occur during
3 OBJECT RELATIONAL MAPPING storing Object Oriented data into tabular relational database are discussed in the following paragraphs. Granularity problem: The problem of granularity arises when there are more or lesserclassesin themodel of objects than the tables of relational database(Chen 2015). The condition in which a set of objects of Object Oriented Program are required to be mapped into a relational database and there is a difference between theamount of objectsin the object model andtables in the relational database tableis known as the problem of granularity. Issue of Inheritance mismatch: The Object Oriented Programming languages have a fundamental concept known as inheritance or sub-types in which one class can acquire the property of other class. However, relational database system does not support anything similar to inheritance or sub-types. A problem arises while converting or mapping objects of an inherited program into relational database as there is no method to implement the concept of inheritance in relational database system and this problem is known as the inheritance mismatch issue. Identity mismatch: The relational database model and object model have different concepts of identity. In the relational database, the identity of rows or database are expressed in the terms of primary key, however in object model, each object has unique identity. The same data will be stored in the different threads while mapping the data from the database to the object model. In that case, a question arises that which object will have the right data that should be persisted in the database. Problem in Association:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
4 OBJECT RELATIONAL MAPPING InObjectOrientedlanguages,associationsarerepresentedintheformof unidirectional references, however in relational database, associations are bidirectional by using foreign keys. The user needs to define the association twice in order to develop a bidirectional relation in Object Oriented languages. Navigation problem: The method of navigating data in Object Oriented Language is different from the way it is done in relational database. The user needs to walk through the object network in order to navigate from one association to other, however the user can navigate and access the data through Structured Query Language (SQL) by loading several entities using JOIN. Comparisonbetween ORM and traditional data access techniques: Object Relational Mappingminimizes the length of the program or codethat is required for accessing and mapping data from relational database in comparison to the traditional technique of accessing data. Therefore, ORM can be helpful in reducing the effort required for the development of the code. In comparison to the traditional data access technique, ORM is more useful for the business centric applications that have complex data structures as it provides better cache management, concurrency control and generation of basic create, read, update and delete (CRUD) code. However, ORM fetches more amount of data than required and therefore it works slower than the traditional data access technique. Therefore, ORM is not suitable for the applications having a simple data structure. Benefits of Object Relational Mapping: Reduction of code: The ORM tool reduces the amount of the code that the developer is required to write for the application. It reduces the time required by the programmer for development of the
5 OBJECT RELATIONAL MAPPING code as it automatically generates whole data access codeaccording tothe modelgivenby the programmer. Management of cache: ORM reduces load of the database server by storing the entities on the cache memory. Therefore, it is useful for the applications having a complex data structure as it provides cache management. Better application management: The codes that are generated by ORM are tested in a well manner, therefore the developer does not need to test it extensively. Limitations and drawbacks of ORM: The Object Relational Mapping is a tool that helps in mapping of objects into relational database, however it also has limitations and drawbacks.The codethat theORM generatesis usually more complicatedthan the program or codethat a developer will write. This is due to the reason that ORM tool is designed for handling a large variety of data access scenarios that is far more than the code that a single application ever requires. The code generated by ORM is slow as it fetches more data than needed. Description of ORM technologies: Java Persistence API: Java Persistence Application Programming Interface (JPA) is specification of java that is used for managing andconvertingdata between objects or classes and relational database. In java industry,JPA is consideredas thestandard method for ORM. It helps the developer in mapping, storing, updating and retrieving data from Java objects to relational database. JPA is a specification and various implementation are available that includes
6 OBJECT RELATIONAL MAPPING Hibernate, Eclipse Link and Apache Open JPA. It isusuallyimplemented to manipulate and access relational database from Java beans and Java Standard Edition (SE). Language Integrated Query: LanguageIntegratedQuery(LINQ)isacombinationofseveralfeaturesand propertiesthat introduced formal query capabilities to the various languages that include Visual Basic and C#. Several adaptable solutions have also been introduced by LINQ in order to fill the gap between relational data and objects. Therefore, it can be said that LINQ acts as a bridge that maps and manipulates the objects of any Object Oriented Programming into the relational database. It is a framework of Microsoft dot Net programming model that adds query capabilities to the dot Net programming languages. Expressive and shorter syntax are provided by these extensions in order to manipulate data. Hibernate Object Relational Mapping: HibernateObjectRelationalMappingisanORMtoolormediumforJava programming. It is an ORM framework that acts as a tool for mapping and manipulating objects or classes into relational database. It uses XML files for mapping object or classes to relational database, therefore the programmer does not require to write much code in order to persist the object. The significant feature orproperty of Hibernate is converting, mappingand manipulating from the object model to relational database and mappingdata types of Java into Structured Query Language (SQL) data types. RedBeanPHP: The RedBeanPHP is an Object Relational Mapping software that is designed for boosting the productivity of the developer. It is distinct from other Object Relational Mapping systems as it does not require any configuration in YAML or XML. The database schema is adapted according to the needs of the code or program by RedBeanPHP. The
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
7 OBJECT RELATIONAL MAPPING creation of tables and columns are done on the fly without any mapping or upfront configuration. The columns to the table are automatically added by RedBean and the type of the columns are changed according to the requirement of the content. It allows the developer tofreezetheschematopreventitfromanyfurtherchangesafteralltherequired modifications are done. Conclusion: It can be concluded from the above discussion that the Object Relational Mapping is a useful tool for mapping and manipulating object or classes from an Object Oriented language to relational database. It acts as a medium for resolving the mismatch issues between the Object Oriented Programs and relational database or tables. There are several mismatch problems that arise during the conversion of object or classes to values in the database. There is a huge difference between the mapping through ORM tool and traditional data access technique. The ORM reduces the length of the code reducing the effort required for the development of the code. There are various advantages of implementing ORM technique for conversion of data, however it also has some limitations and drawbacks.
8 OBJECT RELATIONAL MAPPING References: Correa,B.B.,Wang,Y.andZimanyi,E.,2017.Object-relationalmappingtoolsand Hibernate. Chen, T.H., 2015, April. Improving the quality of large-scale database-centric software systems by analyzing database access code. InData Engineering Workshops (ICDEW), 2015 31st IEEE International Conference on(pp. 245-249). IEEE.