第2个回答 2013-12-13
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/farheart" />
<property name="username" value="root" />
<property name="password" value="root" />
<property name="defaultAutoCommit" value="true" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<!-- <value>com/farheart/model/News.hbm.xml</value> -->
</list>
</property>
</bean>
样例代码本回答被提问者和网友采纳