More Books
Hibernate: A J2EE Developer's Guide
Hibernate: A J2EE™ Developer's Guide
Table of Contents
Copyright
Acknowledgments
About the Author
Preface
Required Skills
Roadmap
Chapter 1. Overview
Why Object/Relational Mapping?
What Is Hibernate?
Comparing JDBC to Hibernate
Hibernate's Mapping System
Other Java/Database Integration Solutions
How to Obtain and Install
Supported Databases
Chapter 2. Getting Oriented
Application Architecture
Mapping Files
Generating Java Source
Application Configuration
Web Application
JSP Interface
Chapter 3. Starting from Java
Java Object Model
Generated Mapping Files
Generated Schema
Working with Artifacts and Owners
Chapter 4. Starting from an Existing Schema
Initial Schema
Using Middlegen
Generated Mapping Files
Generated Java
Working with the Database
Chapter 5. Mapping Files
Basic Structure
Mapping File Reference
Chapter 6. Persistent Objects
Sessions
Objects and Identity
Life-Cycle Methods
Chapter 7. Relationships
Database Relationships
Java Collection Relationships
Java Class Relationships
Any-Based Relationships
Bi-directional Relationships
Chapter 8. Queries
HQL
HQL Reference
Select
From
Where
Group By
Having
Order By
Criteria Queries
Native SQL Queries
Chapter 9. Transactions
Introduction to Transactions
Optimistic and Pessimistic Locking
Chapter 10. Performance
Finding and Solving Problems
Queries
Inserts
Connection Pooling
Caching
Chapter 11. Schema Management
Updating an Existing Schema
Generating Update and Drop Scripts
Chapter 12. Best Practices, Style Guide, Tips and Tricks
Reducing Code with Inversion of Control
Reducing Session Creation Impact with ThreadLocal
Using Hibernate as an EJB BMP Solution
Integrating with Other Technologies
Applications That Use Hibernate
Strategies for Getting Started
Chapter 13. Future Directions
Hibernate 3.0
EJB 3.0
Here and Now
Index
SYMBOL
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X

Using Hibernate as an EJB BMP Solution

Hibernate is intended to work in a wide variety of environments, and works well as a bean-managed persistence (BMP) solution when used in a variety of J2EE application servers. In fact, JBoss has indicated that a future version of its software will likely use Hibernate as the basis for container-managed persistence (CMP).

The development process for BMP and EJB varies tremendously from development environment to environment and therefore is beyond the scope of this text. Conceptually, however, you are relying on your J2EE application server to provide a variety of services, such as identity management, clustering, and JDBC connection pooling, when you use Hibernate to handle the actual generated persistence (specifically, the generated SQL). This affords several advantages, such as the ability to unit test your database access logic outside the context of a full application server and also the ability to understand the persistence performance characteristics of an application independent of the application server. Let's say, for example, that you develop an application intended to target three different application servers. By using Hibernate as your persistence mechanism, you can test your application against your target databases with a greater sense of independence for the tests with the different application servers.

In any event, Hibernate should at most be considered an alternative to EJB container-managed persistence, not the full EJB specification.

If you are interested in using Hibernate in conjunction with EJB, you will find descriptions of the general integration at http://hibernate.org/82.html and http://hibernate.org/166.html. A description of how to add Hibernate as a service to your JBoss installation can be found at http://hibernate.org/66.html.