This Hibernate training is targeted at experienced developers wanting
to become experts with the Hibernate open source object/relational mapping
framework. This is a 3 day class, with 70% spent on theory and 30% labs.
The language is English.
We will introduce the object/relational paradigm mismatch and give you
a high-level overview of the current solutions for this time-consuming
problem. You will learn how to use Hibernate as a persistence layer with
a richly typed domain object model. This persistence layer implementation
covers all entity association, class inheritance and special type mapping
strategies. We will teach you how to tune the Hibernate object query and
transaction system for best performance in highly concurrent multi-user
applications. The extremely flexible Hibernate dual-layer caching system
is also an important topic in this training. The demo application used
in the labs runs standalone, in web application containers or in a full
J2EE application server environment. We discuss the Hibernate integration
in different scenarios and also show you typical architectural problems
in two- and three-tiered database applications. If you have to work with
an existing SQL database, you will also be interested in Hibernate's legacy
database integration features and the Hibernate development toolset.
1. Object/Relational Persistence
We define object persistence and we discuss why a relational database
with a SQL interface is the system for persistent data in today's applications.
We find out why hand-coded Java persistence layers with JDBC and SQL
code are time-consuming and error-prone. After looking at some alternative
solutions for this problem, we introduce object/relational mapping and
talk about the advantages and downsides of this approach.
2. Introducing Hibernate
Hibernate is an excellent and popular framework that can significantly
reduce the time spent with persistence layer implementation in most
Java applications. We give you an architectural overview of Hibernate
and show you the most important application-programming interfaces.
Hibernate is extremely flexible and can be used in almost any development
and production environment; we demonstrate Hibernate configuration in
managed (and non-managed) J2EE and J2SE environments.
3. Object/Relational Mapping
Mapping a simple class to a SQL database schema is indeed trivial, but
with richly typed domain object models, we need a more powerful framework.
We discuss the Hibernate type system and teach you the concepts of Entities
and Value Types. We then map all kinds of entity relationships to a
database schema, including uni- and bi-directional associations, class
inheritance and composition. Hibernate supports very fine-grained mappings
and even allows us to bridge the gap between existing object models
and database schemas.
4. Data Management with Hibernate
This training module basically teaches you how to load and store data
with Hibernate. We teach you the Hibernate interfaces for read and save
operations and we also show you how transitive persistence (persistence
by reachability) works in Hibernate. Hibernate's optimistic concurrency
management is an important aspect of the framework, we show you how
it works and why it will give you excellent performance without bottlenecks
in highly concurrent multi-user applications. We explore the Hibernate
dual-layer caching system (a transaction-scoped cache at the first level
and a global/clustered second-level data cache) with some examples and
best practices.
5. Hibernate Object Queries
Hibernate is well known for it's flexible object query system. The Hibernate
Query Language (HQL) is a powerful and popular object-oriented extension
of SQL, it allows us to express object queries without leaving the Java
language of classes and properties. After discussing HQL and showing
you all the tricks we teach you the Query By Criteria (QBC) API, a type-safe
way to express an object query. Finally, we show you how to translate
complex search dialogs in your application to a Query By Example (QBE)
query. You will get the full power of Hibernate queries by combining
these three features and we will also show you how to use direct SQL
calls for the special cases.
6. Application Architecture
Hibernate is intended to be used in just about any architectural scenario
imaginable (as long as the application is written in Java). Hibernate
might run inside a servlet engine, a web application framework, in a
JMX application server or even in standalone applications. We teach
you some basic practices of Hibernate application architecture. This
includes handling of the SessionFactory, the popular ThreadLocal Session
pattern and encapsulation of the persistence layer functionality in
Data Access Objects (DAO) and J2EE Commands. We also show you how to
design long running Application Transactions and how to use the innovative
Detached Object support in Hibernate. We talk about audit logging, legacy
database schemas, and metadata-driven applications.
7. Hibernate Development with the Toolset
In some projects, the development of a domain model is driven by Java
developers analysing the business domain in object-oriented terms. In
others, it is heavily influenced by an existing SQL data model, either
a legacy database, or a brand new schema designed by a professional
data modeller. Since different projects are starting from different
points, there are several different development scenarios to be considered,
and different tools that may be used in each case. We show you the common
technical pitfalls with either approach and discuss the Hibernate toolset
(hbm2ddl, hbm2java) and the integration with popular
Open Source tools such as XDoclet and Middlegen.