ORM
Table of Contents
object relational mapping ORM
it is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language. It is the automated persistence of objects in a Java application to the tables in a relational database.
ORMs supported by Spring
- Hibernate
- iBatis
- JPA (Java Persistence API)
- TopLink
- JDO (Java Data Objects)
- OJB
ORM consists of
- API for performing basic CRUD operations
- API to express queries refering to classes
- Facilities to specify metadata
- Optimization facilities : dirty checking,lazy associations fetching
ORM levels
- Pure relational (stored procedure.)
- Light objects mapping (JDBC)
- Medium object mapping
- Full object Mapping (composition,inheritance, polymorphism, persistence by reachability)
ORM Advantages
The main advantage of ORM like hibernate is that it shields developers from messy SQL. Apart from this, ORM provides following benefits:
- Improved productivity
- High-level object-oriented API
- Less Java code to write
- No SQL to write
- Improved performance
- Sophisticated caching
- Lazy loading
- Eager loading
- Improved maintainability
- A lot less code to write
- Improved portability
- ORM framework generates database-specific SQL for you
ORM frameworks
- Enterprise$JavaBeans$En7ty$Beans$Java$Data$Objects
- Castor
- TopLink
- Spring\(DAO\)
- Hibernate$etc.
ORM vs DAO
TODO
What is the difference?