首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Spring 宣言式事务配置的一种形式-Hibernate多事务

2012-09-06 
Spring 声明式事务配置的一种形式-Hibernate多事务数据源:jdbc.propertiesjdbc.driverClassNamecom.mysql

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>

热点排行