Will java hibernation not contain sql code?

I did not work with sleep mode. I am a little versed in java. I survived the source of the beast of a Java application created by Oracle (Retail Price Management). I expected that there would be a lot of sql inline code as the application uses the database heavily. But, to my surprise, NO inline SQL code! so far. I found that it uses what is called "Hibernate" from a batch of files .hbm.xml. Is this a trademark for java programs using hibernation or maybe I have not seen the complete code base ?. Can anyone enlighten me how this is possible? Thank.

+5
source share
5 answers

Hibernation, since all ORM tools really reduce or eliminate the need to use raw SQL in Java code due to the following:

  • many associations between different objects are written to the Hibernate mapping, so they are automatically selected by Hibernate - i.e. if you have an aggregated relationship between two classes on the Java side, this can appear as a foreign key relationship in the database, and Hibernate, whenever an instance of class A is loaded, it can automatically load related instances of class B,
  • many queries can be executed in Hibernate HQL query language or using its criteria API.

Under the hood, Hibernate creates SQL to communicate with the database, but this is not visible on the Java side. However, this can be seen in the logs, if included.

, Hibernate, JDBC SQL. "" , .

+2

Hibernate - .

Hibernate - , , .

+1

Hibernate SQL . SQL, (.hbm.xml) , , . showSql, , , SQL .

+1

Hibernate - (ORM). ORM SQL [sic] - ( .hbm.xml), Hibernate . , , Hibernate, SQL, .

+1

Hibernate - , . , , .hbm.xml.

SQL Hibernate ()

, Fruit, T_FRUIT.

, , .hbm.xml . T_FRUIT, ​​ Fruit, Fruit T_FRUIT.

, , / T_FRUIT.

Apple, , , " ". Hibernate .

, , Hibernate , .

When you bear fruit, sleep mode also receives data about fruits and its children (data from link tables). And you can tell if you want to take all the children at once or as needed.

Etc. The goal is to make your life easier, and the code is easy to maintain, easy to read, portable, ...

With this information, let me redirect you .

+1
source

All Articles