Advantages and disadvantages of hibernate

Source: Internet
Author: User

Benefits of Hibernate:

1, the object of. Hibernate lets developers manipulate databases with the idea of a face object. JDBC can only pass the metadata to the database through SQL statements for data manipulation. Hibernate can transform metadata and objects at the bottom, allowing developers to access data only in an object-oriented way.

2, better transplant. Hibernate uses the mechanisms of XML or JPA configuration, database dialect, and so on to make hibernate more portable, and for different databases, developers only need to use the same data operation, without having to worry about the differences between databases. The direct use of JDBC will have to consider the problem of database differences.

3, the development efficiency is high. Hibernate provides a lot of encapsulation (which is also its biggest drawback), many data operations and correlation relationships are encapsulated well, developers do not need to write a large number of SQL statements, which greatly improve the developer's development efficiency.

4, the use of caching mechanisms. Hibernate provides caching mechanisms (session cache, level two cache, query cache), which can be placed in the cache without having to query the database every time they are used, for data that is not easily and frequently used, and the caching mechanism is beneficial for performance improvements.

The main disadvantages of Hibernate are the following:
First, because the persistence layer encapsulation is too complete, so that the developers can not optimize SQL, the flexibility to use the JDBC Native sql,hibernate encapsulation jdbc, so there is no JDBC direct access to the database is highly efficient. Hibernate is not suitable for use with specific optimization mechanisms of the database
Second, the use of the ORM principle in the framework, resulting in the configuration is too complex, once encountered large projects, such as more than 300 tables, configuration files and content is very large, in addition, DTOs flying, performance and maintenance problems with it
Thirdly, if the relationship between the tables in the project is complex, the relationships between the tables are many, and in many places the lazy is set to false, which results in very slow data query and loading, especially when cascading queries.
Four, hibernate in the batch processing of weak, for batch modification, deletion, not suitable for hibernate, which is the weakness of the ORM framework

Advantages and disadvantages of hibernate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.