Before I started learning hibernate, I felt like. NET EF, which is a kind of encapsulation of JDBC, it is very exciting to see so many videos, and we can study well.
first of all, let's say how it works:
1. After configuring Hibernate's configuration file and the configuration file corresponding to the class, start the server.
2. The server instantiates the Configeration object, reads the configuration contents of the Hibernate.cfg.xml file, and builds a table or a mapping relationship with the table based on the relevant requirements.
3. The Sessionfactory instance can be established by instantiating the Configeration object, further, the session object can be created through the Sessionfactory instance.
4. After the session, the database can be added to the check operation, in addition to more complex full-text search, simple operation can be done through the hibernate encapsulated session built-in method.
5. In addition, it is possible to achieve more complex database design through the association of Things management and tables.
More and more like our University Cloud Platform 3.0 use of the underlying architecture, so the knowledge is the same bar.
Let's talk about the pros and cons:
1. First consider performance issues, our evaluation is a good example, because the persistence layer encapsulation is too complete, so that 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 efficiency. Hibernate is not suitable for use with specific optimization mechanisms of the database
2. The use of ORM in the framework, resulting in configuration is too complex, once encountered large projects, such as more than 300 tables, configuration files and content is very large, in addition, the DTO flying, performance and maintenance problems with it
3. 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 slow data query and loading, especially when cascading queries.
4.Hibernate is weak in batch data processing, for batch modification, deletion, not suitable for hibernate, which is the weakness of the ORM framework.
5. The advantage is that hibernate corresponds to a bridge between Java classes and database tables, and we can do a lot of things with this bridge.
Hibernate video more, to a good summary and experience to understand the essence of hibernate ah.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Hibernate series-hibernate principle