Hibernate analysis [Collection]

zhaozj2021-02-16  43

First, Hibernate is a lightweight object package for JDBC, which is a separate object persistent layer frame, and the App Server, and the EJB has no inevitable connection. Hibernate can be used in any case where any JDBC can be used, such as the database access code of the Java application, and the implementation class of the DAO interface, can even be the code of accessing the database inside BMP. In this sense, Hibernate and EB are not something in a category, nor does it exist. Second, hibernate is a framework closely associated with JDBC, so Hibernate's compatibility and JDBC driver, and databases have a certain relationship, but use its Java program, and APP Server does not have any relationship, and there is no compatibility problem. . Third, Hibernate can't be used to compare directly with Entity Beans, only in the framework of the J2EE project can be compared. And even if it is placed in the software overall frame, Hibernate is also an alternative to JDBC, rather than the alternatives of entity beans, let me listen to the frame structure of N times, I have listed N times: Traditional architecture : 1) Session bean <-> DB In order to solve the alternative architecture of performance barriers: 2) Session bean <-> DAO <-> JDBC <-> DB Using Hibernate to improve the development efficiency of the above architecture: 3) Session bean <-> DAO <-> Hibernate <-> DB is analyzed above 3 architectures: 1, memory consumption: Architecture 2 using JDBC 2 is undoubtedly the most survival, Hibernate architecture 3 times, EB Architecture 1 is the worst. 2, running efficiency: If the JDBC code is written very optimized, the JDBC architecture has the highest efficiency, but in the actual project, this is almost can't do. This requires the programmer very proficient in JDBC, use the BATCH statement, adjust the preapredstatement Batch size And the parameters such as FETCH Size, as well as the result set cache, etc. In general, the programmer can't do this. Therefore, the Hibernate architecture exhibits the fastest running efficiency. The architectural efficiency of EB is very far. 3, development efficiency: With JBuilder support and simple project, EB architecture has the highest efficiency, JDBC, Hibernate is the worst. However, in the case of large projects, especially the persistent layer relationship, Hibernate is highly efficient, and the EB architecture is likely to fail. 4, distributed, safety inspection, cluster, load balancing support because there is SB as Facade, three architectures have no difference.

转载请注明原文地址:https://www.9cbs.com/read-20466.html

New Post(0)