Thursday, 12 January 2012

Spring Setting For Hibernate

Dear All,

Please Make the following entry into the applicationContext.xml

<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:hsql://localhost/"/>
<property name="username" value="SA"/>
<property name="password" value=""/>
</bean>
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="myDataSource"/>
<property name="mappingResources">
<list>
<value>config/person.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
</bean>
<bean id="personDaoHibernate" class="com.sapient.dao.impl.PersonDAOHibernateImpl">
<property name="sessionFactory" ref="mySessionFactory"></property>
</bean>

Regards,
Vivek Mehta

No comments:

Post a Comment