<bean id=”sessionFactory”
class=”org.springframework.orm.hibernate4.LocalSessionFactoryBean”>
<property name=”configLocation” value=”file:src/hibernate.cfg.xml”>
</property>
<property name=”dataSource” ref=”dataSource”></property>
</bean>
<bean id=”dataSource”
class=”org.springframework.jdbc.datasource.DriverManagerDataSource”>
<property name=”driverClassName” value=”com.mysql.jdbc.Driver” />
<property name=”url”
value=”jdbc:mysql://localhost:3306/test” />
<property name=”username” value=”root” />
<property name=”password” value=”admin” />
</bean>
I worked on the tutorial HibernateSpringProject
However, the database connect always use hibernate.cfg.xml but not from dataSource bean. Why we spend time on creating dataSource?