2. What is an Object Relational Mapper (ORM)?
- Definition: ORM is a programming technique that bridges the gap between the object-oriented paradigm of a programming language and relational databases.
- Purpose:
- Maps Java objects to database tables and vice versa.
- Reduces boilerplate code for SQL queries.
- Advantages:
- Simplifies database operations.
- Enforces consistency between the object model and the database schema.
- Enhances developer productivity.
- How It Works:
- Annotates classes with metadata (e.g.,
@Entity
, @Table
).
- Provides mechanisms for CRUD operations without writing SQL manually.