Get the App
SLTechnology News&Howtos  ›  Development  › 

An example Analysis of Hibernate object Relational Mapping

Shulou Source: shulou.com Published: 2022-06-02 08:00:28 10月04日 Update

This article introduces the relevant knowledge of "Hibernate object-relational mapping example analysis". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Also due to the influence of Hibernate official documents, many Hibernate developers mistakenly think that Hibernate object-relational mapping must have a table corresponding to an object, and put the mapping file and the object file in the same directory. In fact, the pattern is designed for normative considerations, because in a multi-person project, it is easy to conflict when multiple people want to maintain the same file; when the project is relatively small and the configuration file has fewer maintenance personnel, we can use it. Hbm.xml files are merged into one or more files. According to the author's own project design and development experience, if there are several people in the project who are engaged in Omax R mapping and persistence at the same time, several will be set. Hbm.xml file, one for each person. Of course, in order to facilitate classification and management, each person's work should be divided logically.

Examples of file configurations in large projects are as follows:

Examples of file configurations in small projects are as follows:

It is important to note that the analysis of the Hibernate source code shows that when specifying Hibernate object relational mapping, you cannot use an absolute directory, only a relative directory; moreover, the system uses the classes root directory as the current directory.

This is the end of the content of "Hibernate object-relational mapping example analysis". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Files objects projects directories analysis configuration content multiple people actual more knowledge examples work development design practical successful learning and then people authors Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information MariaDB Huawei Docker