InterviewSolution
| 1. |
What do you understand by ORM? |
|
Answer» ORM stands for Object-Relational Mapping that transforms objects of Java class to tables in relational databases and vice versa using metadata describing the mapping between the database and the objects. This is represented as shown in the below image: Consider an example where we have an Employee class having employeeId, firstName, lastName, contactNo as attributes. Consider we also have an Employee table that has ID, FNAME, LNAME and CONTACT_NO as COLUMNS. If we want to send DATA from our Java application and save it in the database, we cannot do it straightforwardly by simply saving the Java objects in the database directly. We need some SORT of a mapper that maps the Java objects to the records that are compatible to be saved in the database table. This is where ORM comes into the picture. ORM helps in this transformation while writing data to the database as described in the below image: The database records cannot be directly CONSUMED by the Java applications as Java only deals with objects. ORM again plays a major role in the transformation of database records to Java objects. |
|