Ans. Repositories represent data present in the database in the form of objects.
Sometimes there can be multiple tables to represent an object properties. For example, a table to represent a user, another table to represent addresses, and maybe another table to represent the association of user and his address.
If we write JDBC queries, we will have to write a very complex JDBC query using joins in various tables, which can be very un-readable and time consuming.
Repositories make this easier by providing APIs for CRUD(Create, Read, Update, Delete) operations on the database. We just have to define an XML to map database columns to Java Objects (Item-Descriptor) and we can simply use the API for CRUD operations rather having to write heavy and error-prone SQL queries. These APIs operate on java objects and change the data inside the database internally (using OOTB code).
Repositories also provide various methods of caching the data and queries, which is an advantage over typical JDBC connections. See Repository Caching HERE.
Asked By: Wipro, TAISTech, Sapient
Sometimes there can be multiple tables to represent an object properties. For example, a table to represent a user, another table to represent addresses, and maybe another table to represent the association of user and his address.
If we write JDBC queries, we will have to write a very complex JDBC query using joins in various tables, which can be very un-readable and time consuming.
Repositories make this easier by providing APIs for CRUD(Create, Read, Update, Delete) operations on the database. We just have to define an XML to map database columns to Java Objects (Item-Descriptor) and we can simply use the API for CRUD operations rather having to write heavy and error-prone SQL queries. These APIs operate on java objects and change the data inside the database internally (using OOTB code).
Repositories also provide various methods of caching the data and queries, which is an advantage over typical JDBC connections. See Repository Caching HERE.
Asked By: Wipro, TAISTech, Sapient
No comments:
Post a Comment