以我做的一个测试代码中配置为例
spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:/mapping/hibernate.cfg.xml</value>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="AbstractDAOProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="UserDAO"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
parent="AbstractDAOProxy">
<property name="target">
<bean class="dao.UserDAOHibernate">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
</property>
</bean>
</beans>
hibernate.cfb.xml
<?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" >
<hibernate-configuration>
<session-factory name="spring_hibernate">
<property name="hibernate.connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="hibernate.connection.url">
jdbc:oracle:thin(DESCRIPTION = (ADDRESS_LIST = (ADDRESS =
(PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = 1521)) )
(CONNECT_DATA = (SID = xx)(SERVER = DEDICATED)) )
</property>
<property name="hibernate.connection.username">xxxx</property>
<property name="hibernate.connection.password">
xxxxxxxxxxxx
</property>
<property name="hibernate.dbcp.maxActive">100</property>
<property name="hibernate.dbcp.whenExhaustedAction">1</property>
<property name="hibernate.dbcp.maxWait">120000</property>
<property name="hibernate.dbcp.maxIdle">10</property>
<property name="hibernate.dialect">
org.hibernate.dialect.OracleDialect
</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.OSCacheProvider
</property>
<mapping resource="mapping/People.hbm.xml" />
<mapping resource="mapping/Lob.hbm.xml" />
<class-cache usage="read-only" class="domain.People" />
</session-factory>
</hibernate-configuration>