Home java How does JDBC and ORM?

How does JDBC and ORM?

Author

Date

Category

read enough information about JDBC and ORM, now I would like to test your understanding of working with the database in Java and set a couple of questions regarding JDBC, JPA, ORM (Hibernate).

  1. jdbc This is an interface for working with SQL queries in Java.
  2. ORM This is also an interface that is built by the JPA specification and it has several implementations such as Hibernate, EclipseLink, etc. ORM works on the principle of mapping objects from Java to the tables and their columns in the database, all this makes it with the help of anatations, and ORM requests is itself

As I realized that the JDBC is that ORM make the same difference only difficulties and optimization for different projects, that is, it is sometimes profitable to use JDBC, and sometimes ORM.

Tell me please do I argue correctly?


Answer 1

No wrong arguing.

JDBC is a basis – ORM is an add-in over JDBC.

JDBC is a nails that can be told to say a stool, and ORM is an automatic gun that clog nails.

A programmer who writes on JDBC looks like a hardworker who scores nails with a hand hammer, slowly and stubbornly. If you are using ORM, it is already similar to a qualified worker who clogs nails with a pneumopistolet: quickly and reliably.


Answer 2

JDBC is a means of working with a database from Java.
Hibernate (and JPA) – Designed to separate work in Java from work in the database. At the same time, the programmer works in Java, implements business rules, and synchronization questions from the database entrustes Hibernate. The programmer writes to Java using the sublime abstractions of the OOP (in particular inheritance), and Hibernate, in accordance with the settings and mappings (which can also create Hibernate) produces synchronization and tightening objects on demand. It is assumed that the programmer does not write requests for SELECT, INSERT, DELETE, UPDATE (although such an opportunity and is provided) and SpringData further enhances this opportunity. For example, a programmer in Java requests an object of the object and its ID through the HiberNate, changes the fields of this object and then requests the synchronization of this object with the database. Hibernate himself understands how to write SELECT and how to write update.
Hibernate is relational storage (Java objects) for Java Ideomatics.


Answer 3

Write a pair of test projects on Spring Data JDBC and Spring Data JPA – Feel the difference. On work, various solutions can meet, requiring support, but it is necessary to know that and that.

Spring Data JDBC – manage the appeals to the database. Knowledge requires SQL .

Spring Data JPA – simplifies access to database with Java. Knowledge SQL is not required, but can be useful.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions