Difference between JDBC and Hibernate?
Give one sample based on the variance?
Answer Posted / mukundan
Hibernate is one level above JDBC in the sense that Hiberate
internally uses JDBC. Hence a direct comparison may not be
effecient. Still...
Hibernate is Object based mapping (ORM). JDBC concerns more
of RDB meta data mapped to the members of the java objects
i.e. POJO.
Data sent and results returned from RDB loaded back into
Domain (POJO) objects are taken care internally by
Hibernate. In JDBC loading the returned data from RDB into
java objects to be done externally, by developer.
Hibernate caches data at Level 1 and supports optional Level
2 caching through third party software (ehcache,
TreeCache/JBoss cache etc.) Caching is totally external to
JDBC.
Hibernate supports HQL which is again more Java Object
based. JDBC supports only SQL and relating and loading Java
objects should be done externally by developer.
Hibernate supports lazy loading of objects which JDBC
doesn't support.
RDB Table dependency and integrity in Hibernate is supported
through Object relationships. It is external to JDBC.
Through Object relationship (defined in XML) the entire RDB
DDL could be generated. This is out of scope in JDBC.
| Is This Answer Correct ? | 25 Yes | 4 No |
Post New Answer View All Answers
How java can be connected to a database?
What is transaction processing in jdbc?
What is jdbc odbc connection?
How do I start debugging problems related to the JDBC API?
What are the differences between resultset and rowset?
What is execute in java?
Jdbc-odbc bridge is multi-threaded or not?
What are different types of JDBC Drivers?
Why is jdbc used?
What is JDBC DataSource and what are it’s benefits?
What are four types of JDBC driver?
Which type of driver provides jdbc access via one or more odbc drivers?
What is jdbc class forname?
What is jdbc url for mysql?
What happens if connection is not closed in jdbc?