Hibernate it's a lightweight. ormapping Framework. Learn entityframework , will feel very kind.
For various levels of programmer design of the database:
The monkey does this: first consider the storage of data, the implementation of the function, how to facilitate how to. As for the redundant God horse, do not consider.
Senior Program Apes do this: first design a relational model of the database, draw with tools ER diagram, or draw a physical model. Consider the relational model. Better know how to use tools to transform a well-designed model into a database script. and throw it in the database. Then, in the function implementation process, for the difficult to implement the function, calculate, or modify the database. That's good to do.
The ash-level program apes do this: first analyze the business requirements, design the object model. Consider various degrees of multiplicity, maintain relationships, and so on. Consider the storage performance of data, the impact of data volume ...
The above is purely .....
In an object-oriented world, the object model is very important. Because object-oriented thinking makes the responsibilities clearer.
With object-oriented programming, the table structure can be used without regard to the development process. There is no concept of a table in my mind. operations are performed on objects only.
Hibernate as a persistence layer:
Use Hibernate Benefits of:
1 , so that the developer's responsibilities are exclusive. Hibernate itself encapsulates a set of mechanisms. the object model is automatically converted into a table structure through the object model and *.hbm.xml configuration information. Enables developers to focus on objects only, ignoring table structures. Object-oriented development.
2 , durable layer is easy to replace . Hibernate is a lightweight, durable layer frame and is easy to replace. For example, change the storage mode, only need to modify the *.hbm.xml file. Rebuilds the table structure. And the code does not have to be modified. So it 's easier to convert with hibernate
3 and improves the coding efficiency . Using hibernate as the persistence layer eliminates the JDBC code. So that business layer developers do not need to consider the logical structure of data, only the business data entities.
Hibernate Disadvantages of:
1 and inflexible . Since the operations are all objects, it is inconvenient compared to using traditional SQL statements.
3 and achieve complexity . and many complex query SQL statements are difficult to query with hibernate . Therefore, it is difficult for the program to be tuned.
3 , Big Data processing is slow . The transformation of the object model and the relational model will lead to time consumption. So hibernate still has problems with large quantities of data operations.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Getting Started with Hibernate (a) comparison of the pros and cons of--hibernate