When hibernate was used independently, Hibernate had its own configuration file hibernate. cfg. XML, which is now under spring management. The bean is merged into applicationcontext. xml.
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"><property name="driverClassName" value="com.mysql.jdbc.Driver"></property><property name="url" value="jdbc:mysql://localhost:3306/sms"></property><property name="username" value="root"></property><property name="password" value="123"></property></bean><bean id="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="dataSource"><ref bean="dataSource" /></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop></props></property><property name="mappingResources"><list><value>com/sms/database/data/TSmsUser.hbm.xml</value></list></property></bean>
Compare the previous configurations of Hibernate
<?xml version='1.0' encoding='utf-8'?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
One point is that the hibernate configuration is in
<Sessionfactory>
</Sessionfactory>
In this label, that is to say, the hibernate configuration serves sessionfactory. Property name = "?? "The value of this question mark must refer to some configuration items.
The following is a possible configuration item after the context prompt in spring,
In this way, Hibernate and spring are integrated.
To be continued ~~~