Accounting for 134 Yang Chao
One of Hibernate's lightweight ORM models has evolved into a de facto Java ORM Industry standard by gradually establishing leadership in the Java ORM Architecture and even replacing the complex and cumbersome EJB model. And many of these designs have been absorbed by the Java EE Standards Organization and become the standard of the latest EJB 3.0 specification.
Two hibernate definitions
Hibernate is an object-relational mapping solution under the Java language. It is a free, open-source software. It is used to map objects represented by object model to the structure of SQL-based relational model, and provides a convenient framework for the mapping of object-oriented domain model to traditional relational database.
Note where the mapping file is stored:
The role of three hibernate
Hibernate not only manages the Java class-to-database table mappings (including mappings from Java data types to SQL data types), but also provides methods for querying data and fetching data, dramatically reducing the time it takes to process data manually using SQL and JDBC during development.
It is designed to liberate software developers from many of the same data persistence-related programming work. Whether you start with a draft design or a legacy database, developers can use hibernate.
Application of four Hibernate
Hibernate provides a very lightweight object encapsulation of JDBC, which allows Java programmers to manipulate databases with the object programming mindset. Hibernate can be used in any use of JDBC, either in Java client programs or in servlet/jsp Web applications. The most revolutionary is that hibernate can replace CMP in the Java EE architecture of the application EJB (Enterprise JavaBeans is the framework of application of business computing) to complete the task of data persistence.
Introduction to the five Hibernate API
The interfaces in the 1 Hibernate API can be divided into the following categories:
(1) Provide access to the database operation interface, including session, Transaction, query interface;
(2) interface for configuring hibernate, configuration;
(3) An indirect interface that allows the application to accept events occurring within Hibernate and respond to them, including: Interceptor, Lifecycle, validatable;
(4) An interface for extending hibernate functions, such as usertype, Compositeusertype, identifiergenerator interfaces.
Hibernate internally also encapsulates JDBC, JTA (Java Transaction API), and Jndi (Java naming and Directory Interface). Where JDBC provides the underlying data access operation, hibernate can access any database system as long as the user provides the appropriate JDBC driver. JTA and Jndi enable hibernate to integrate with the Java EE Application Server.
2 Hibernate's core interface block diagram
Advantages and disadvantages of six hibernate
(1) Advantages:
A.hibernate uses the Java reflection mechanism rather than the bytecode enhancer to achieve transparency.
The performance of b.hibernate is very good because it is a lightweight framework. The flexibility of the mapping is excellent.
C. It supports a variety of relational databases, ranging from one-to-one to many-to-many complex relationships.
(2) Disadvantages:
Hibernate restricts the object model that you use. For example, a persistent class cannot be mapped to more than one table.
You are reading: Introduction to the Hibernate framework
Simple application of Hibernate