Java Reference
In-Depth Information
<prop key="java.naming.provider.url">
<prop key="java.naming.factory.url.pkgs">
<bean id="hibernateSessionFactory"
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<property name="hibernateProperties">
hibernate.dialect= org.hibernate.dialect.Oracle9Dialect
LocalSessionFactoryBean is a factory bean that creates a Hibernate SessionFactory
from the supplied configuration parameters and data source object. Note that Hibernate
ORM knows all about the PolicyDetail POJO from the mapping resource policydetail.
hbm.xml . Since I intend to support Oracle Database for now, I have configured
Oracle9Dialect . Thus, switching to another database is just a matter of configuration.
You will need to change your data source configuration and the dialect used by
SessionFactory .
It is not advisable to directly expose the ORM persistence API to the business tier
objects. I will use the DAO to wrap the underlying ORM access. Spring ORM provides the
convenience base class HibernateDaoSupport just for this purpose. Listing 5-16 shows the
modified PolicyDetailDaoImpl from Listing 5-12.
Search WWH ::

Custom Search