Hibernate is an advanced framework for persistent object handling in Java. Built on Java Database Connectivity (JDBC), Hibernate helps to bridge the conceptual and technical gap between the object-oriented features of Java, and the relational features of structured query language (SQL)-based database management systems (DBMSs). It provides flexible ways to map relational tables, associations, and transactions to Java capabilities. The user is provided with Java classes and Extensible Markup Language (XML) descriptors. These can be used in a declarative way to define the mapping between the two models, by providing the configurational and parametric information in descriptive mapping files.
The differences between Java Virtual Machines (JVM) and persistence and transient and persistent objects, and the problems of sessions and object life cycles are addressed and illustrated in detail. With respect to transactions, a chapter is devoted to the handling of optimistic and pessimistic strategies for locking, and the use of the Java Transactions application programming interface (API) (JTA) is touched upon. The efficiency of the established connection is crucial. The use of a driver monitor, through which analysis data on interactions can be collected and viewed, to improve performance, is explained.
There are other available frameworks from DBMS vendors (like Oracle and IBM) with similar functionality. These systems are proprietary, however. Hibernate is not only DBMS-independent, but it can automatically detect the current dialect.
Hibernate is compared to other Java/database integration solutions. Another tool, Java Data Objects (JDO), is similar from a functional point of view, but it requires compile-time preprocessing, while Hibernate does these tasks at the beginning of the execution. In a Java 2 Platform Enterprise Edition (J2EE) server implementation, based on Enterprise JavaBeans (EJB) 2.x, container-managed entity persistence can be replaced by Hibernate to facilitate portability. The forthcoming EJB 3.0 is much more similar to Hibernate than existing EJB versions. Further versions of Hibernate can be efficiently applied, at least until the appearance of robust EJB 3.0 implementations.
This book is a practical introduction to the system and its use. It provides the uniform resource locators (URLs) of, and installation hints for, freely downloadable tools and systems, which are presented in detailed examples. In the beginning chapters, the author explains, using different examples, the different situations that arise in building applications, starting from the main mapping file, Java, or an existing database schema. In a closing chapter, application tips and best practices are given for several environments and cases.