![]() |
VOOZH | about |
ORM (Object Relational Mapping) and JDBC are two approaches used to interact with databases in Java. JDBC is a low-level API where developers write SQL and manage data manually, while ORM (used by frameworks like Hibernate) works with objects and automatically maps them to database tables.
ORM is a technique that maps Java objects to database tables, allowing developers to interact with the database using object-oriented concepts instead of SQL. It reduces the complexity of handling data and improves code maintainability.
JDBC is a Java API used to connect with databases and execute SQL queries directly. It provides full control over database operations but requires more manual coding and effort.
The following Table describe the differences:
Object Relational Mapping | Java Database Connectivity |
|---|---|
| Little slower than JDBC | It is faster compared to ORM |
| SQL queries requirement is comparatively quite less however this doesn't mean that you have to do less work using ORM | SQL queries are required here |
| Hibernate framework (working on ORM technology) makes it easy to store objects/data to database automatically without writing manual code | We have to write code manually to store objects/ data in the database |
| The flow from Object/data to hibernate i.e. the frontend part is based on the ORM technique | Whereas when the data is stored in the database finally i.e., the backend part is still based on JDBCin |
| There are not many restrictions while dealing with data. Even a single database cell can be retrieved, changed, and saved. | JDBC comes with a lot of restrictions on extracting the result-set, processing it, and then committing it back to the database. |