<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- ========================= RESOURCE DEFINITIONS ========================= --> <!-- Local Apache Commons DBCP DataSource that refers to a combined database --> <!-- (see dataAccessContext-jta.xml for an alternative) --> <!-- The placeholders are resolved from jdbc.properties through --> <!-- the PropertyPlaceholderConfigurer in applicationContext.xml --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property> <property name="url"><value>jdbc:mysql://localhost:3306/jpetstore</value></property> <property name="username" ><value>root</value></property> <property name="password" ><value>123456</value></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource"/> </property> <property name="mappingResources"> <list> <value>srx/test/hibernate/Account.hbm</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> net.sf.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate.showsql"> true </prop> </props> </property> </bean> <!-- Transaction manager for a single JDBC DataSource --> <!-- (see dataAccessContext-jta.xml for an alternative) --> <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <!-- this bellow is hibernate configuration for srx test--> <bean id="userDAO" class="srx.test.testhibernate.UserDAO"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> </beans> |
新闻热点
疑难解答