hibernate xml template
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<tx:annotation-driven />
<context:component-scan
base-package="com.atul.spring.springorm.product.dao.impl"></context:component-scan>
<bean
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
name="dataSource" p:driverClassName="com.mysql.jdbc.Driver"
p:url="jdbc:mysql://localhost/mydb" p:username="root"
p:password="" />
<bean
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
name="sessionFactory" p:dataSource-ref="dataSource">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.atul.spring.springorm.product.entity.Product</value>
</list>
</property>
</bean>
<bean class="org.springframework.orm.hibernate5.HibernateTemplate"
name="hibernateTemplate" p:sessionFactory-ref="sessionFactory" />
<bean
class="org.springframework.orm.hibernate5.HibernateTransactionManager"
name="transactionManager" p:sessionFactory-ref="sessionFactory" />
</beans>