I know that Hibernate uses JDBC behind the scenes, but how does it do this/ where does it do this?
JDBC enables developers to create queries and update data to a relational database using the Structured Query Language (SQL). Hibernate uses HQL (Hibernate Query Language) which is similar to SQL but understands object-oriented concepts like inheritance, association etc.
JDBC is acronym of Java database connectivity. It is used to connect your application to the database and transactions . It is an open source Java api. Hibernate is also used for connect your application to database and to do database related transactions but with different approach.
Both Hibernate & JDBC facilitate accessing relational tables with Java code. Hibernate is a more efficient & object-oriented approach for accessing a database. However, it is a bit slower performance-wise in comparison to JDBC. Depending on the requirement of your project, you can choose the most suitable option.
Hibernate uses JDBC to connect to the database and execute the dynamic SQL that it generates.
Hibernate is nothing more than a SQL generation engine - it uses your objects and mappings to generate SQL for you instead of making you write it by hand.
Once it does that, everything is the same as if you had written the SQL yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With