Spring 声明式事务配置的一种形式-Hibernate多事务
数据源:
jdbc.properties
jdbc.driverClassName=com.mysql.jdbc.Driverjdbc.url=jdbc\:mysql\://localhost\:3306/wgfmcg?autoReconnect\=true&useUnicode\=true&characterEncoding\=utf-8jdbc.username=usernamejdbc.password=passwordjdbc.maximumConnectionCount=200jdbc.houseKeepingSleepTime=15000jdbc.houseKeepingTestSql=select CURRENT_DATEjdbc.testBeforeUse=truejdbc.alias=mysqlProxoolDataSourcejdbc.simultaneousBuildThrottle=1000jdbc.trace=falsejdbc.initialPoolSize=10jdbc.maxIdleTime=60jdbc.acquireIncrement=5jdbc.maxStatements=0jdbc.idleConnectionTestPeriod=60jdbc.acquireRetryAttempts=30jdbc.breakAfterAcquireFailure=truejdbc.testConnectionOnCheckout=falsehibernate.dialect=org.hibernate.dialect.MySQL5Dialectpagemax=10telephone=153,133,189failsendnum=3failsendtime=30sendnumber=11100011111111sessionTime=12startupsms=trueserverip=202.102.126.40exigenceinform=//BREW:0x01098087://KMS://MSG/changeserverip=//BREW:0x01098087://KMS://SET/personorientation=http://202.102.112.30/login.do?#jdbc.driver=oracle.jdbc.driver.OracleDriver#jdbc.url=jdbc\:oracle\:thin\:@localhost\:1521\:ORCL#jdbc.username=username#jdbc.password=passwordjdbc.useUnicode=truejdbc.characterEncoding=UTF-8
<!--此bean告诉Spring去哪找数据库的配置信息,因为有此Bean才出现下面用${}标记来取变量的语句--><bean id="propertyConfigurer" value="/WEB-INF/jdbc.properties" /></bean><bean id="dataSource" ref="dataSource" /><property name="mappingResources"><!-- Add by B.G. Dexin Zhang at Mar 5 2009 --> <value> <!-- Hibernate数据源--> <!-- com/jsict/fmcg/vo/TArea.hbm.xml --></value></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">${hibernate.dialect}</prop><prop key="hibernate.show_sql">false</prop><prop key="hibernate.generate_statistics">true</prop><prop key="hibernate.connection.autocommit">false</prop><prop key="hibernate.connection.release_mode">after_statement</prop><prop key="hibernate.cache.use_second_level_cache">false</prop><prop key="hibernate.max_fetch_depth">15</prop></props></property><property name="eventListeners"><map><entry key="merge"><bean/></entry></map></property></bean>
<bean id="transactionManager" ref="sessionFactory" /></bean>
<bean id="transactionInterceptor" ref="transactionManager" /> <property name="transactionAttributeSource"> <value> <!--com.jsict.fmcg.demo.TestAction.find*=PROPAGATION_REQUIRED,ISOLATION_DEFAULT,-ESPException,-RuntimeException--> </value> </property></bean><beanref="transactionInterceptor" /></bean><!-- Hibernate 3.0's JMX statistics service --><!-- Implements the StatisticsServiceMBean management interface --><bean name="broadengate:type=HibernateStatistics" ref="sessionFactory" /></bean>