Java Reference
In-Depth Information
public String getProductCd() {
return productCd;
public void setProductCd(String productCd) {
this.productCd = productCd;
As I mentioned at the start of this chapter, more and more Java EE applications are
switching to ORM instead of the straight JDBC approach. Although Spring JDBC simpli-
fies things to a great extent, there are certain scenarios where you are better served by
ORM. ORMs are better suited to provide POJO persistence. They provide an OO way to
access the RDBMS. ORM is most useful for applications such as eInsure that need to be
portable across a variety of databases. The Spring ORM module provides extensive sup-
port to integrate with all leading ORM solutions such as Hibernate, TopLink, JPOX, and
OpenJPA. In the next few sections, I will take you on a tour of using Hibernate 3 with
Spring ORM. For this discussion, I assume you are familiar with Hibernate. If you are new
to Hibernate, you can take a look at the product documentation at http://www. .
The first step to using Hibernate with Spring ORM is to set up the Hibernate
SessionFactory with a data source, as shown in Listing 5-15. SessionFactory is responsible
for creating session objects. You can think of sessions as abstractions of the underlying
database connection.
Listing 5-15. UnderwritingDao-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xsi:schemaLocation=" ">
<bean id="datasource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="einsureDatasource" />
<property name="jndiEnvironment">
<prop key="java.naming.factory.initial">
Search WWH ::

Custom Search