beautypg.com

Deploying empinfo on nonstop, Running empinfo on nonstop, Integrating hibernate into spring – HP Integrity NonStop J-Series User Manual

Page 237: Why integrate hibernate into spring

background image

Deploying EmpInfo on NonStop

Deploying EmpInfo on Nonstop involves creating the application WAR file on Windows and
deploying the EmpInfo WAR file in NSJSP on NonStop. For more information, see:

“Creating the Application WAR File on Windows” (page 87)

“Deploying Sample Applications on NonStop” (page 331)

Running EmpInfo on NonStop

To run EmpInfo on the NonStop system, click the /<servlet directory>/EmpInfo path under
Applications in the NSJSP Manager screen.

You can now add, search, and delete employee details as explained in the

“Getting Started with

Spring” (page 38)

section.

Integrating Hibernate into Spring

This section describes how a Spring application can use Hibernate for its database operation. This
is demonstrated by modifying the EmpInfo application (developed in the

“Getting Started with

Spring” (page 38)

section) using the Eclipse Galileo IDE.

The following topics are discussed in this section:

“Why Integrate Hibernate into Spring” (page 237)

“Example of Integrating Hibernate into Spring” (page 238)

Why Integrate Hibernate into Spring

Hibernate is a powerful ORM tool that enables an application to access data from any database
in a platform-independent manner. Therefore, the need for Spring to depend on low-level JDBC
details, such as managing connections, dealing with statements and result sets, is greatly reduced.
As a result, all necessary details for accessing a particular data source can be configured in XML
files.

However, a disadvantage of using Hibernate is that the client application that accesses the database
using Hibernate framework will depend on Hibernate APIs, such as Configuration, SessionFactory
, and Session. These APIs will continue to get scattered across the code throughout the application.
Moreover, the application code must be manually maintained to manage the business objects.

In Spring, the business objects can be highly configurable using the Inversion of Control (IOC)
Container. Therefore, the state of an object can be externalized from the application code, thereby
enabling the use of Hibernate objects as Spring Beans. Also, the Data Access Object (DAO) support
in Spring facilitates data access technologies such as JDBC, Hibernate, or Java Data Objects (JDO)
in a consistent way.

The JDBC support in Spring for Object Relational Mapping frameworks provide integration points
to the frameworks and other services such as:

Integrated support for Spring declarative transactions

Transparent exception handling

Thread-safe and lightweight template classes

DAO support classes

Resource management

Integrating Hibernate with Spring allows the application to use both the Spring features and the
Hibernate features of accessing the database.

Integrating Hibernate into Spring 237

This manual is related to the following products: