`
eastPoint
  • 浏览: 54032 次
  • 性别: Icon_minigender_1
  • 来自: 湖北武汉
社区版块
存档分类
最新评论

Transaction management strategies

阅读更多
xml 代码
  1. <beans>  
  2.   
  3.   <bean id="myDataSource1" class="org.springframework.jndi.JndiObjectFactoryBean">  
  4.     <property name="jndiName value="java:comp/env/jdbc/myds1"/>  
  5.   </bean>  
  6.   
  7.   <bean id="myDataSource2" class="org.springframework.jndi.JndiObjectFactoryBean">  
  8.     <property name="jndiName" value="java:comp/env/jdbc/myds2"/>  
  9.   </bean>  
  10.   
  11.   <bean id="mySessionFactory1" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">  
  12.     <property name="dataSource" ref="myDataSource1"/>  
  13.     <property name="mappingResources">  
  14.       <list>  
  15.         <value>product.hbm.xml</value>  
  16.       </list>  
  17.     </property>  
  18.     <property name="hibernateProperties">  
  19.       <props>  
  20.         <prop key="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</prop>  
  21.       </props>  
  22.     </property>  
  23.   </bean>  
  24.   
  25.   <bean id="mySessionFactory2" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">  
  26.     <property name="dataSource" ref="myDataSource2"/>  
  27.     <property name="mappingResources">  
  28.       <list>  
  29.         <value>inventory.hbm.xml</value>  
  30.       </list>  
  31.     </property>  
  32.     <property name="hibernateProperties">  
  33.       <props>  
  34.         <prop key="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</prop>  
  35.       </props>  
  36.     </property>  
  37.   </bean>  
  38.   
  39.   <bean id="myTxManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>  
  40.   
  41.   <bean id="myProductDao" class="product.ProductDaoImpl">  
  42.     <property name="sessionFactory" ref="mySessionFactory1"/>  
  43.   </bean>  
  44.   
  45.   <bean id="myInventoryDao" class="product.InventoryDaoImpl">  
  46.     <property name="sessionFactory" ref="mySessionFactory2"/>  
  47.   </bean>  
  48.   
  49.   <bean id="myProductServiceTarget" class="product.ProductServiceImpl">  
  50.     <property name="productDao" ref="myProductDao"/>  
  51.     <property name="inventoryDao" ref="myInventoryDao"/>  
  52.   </bean>  
  53.   
  54.   <bean id="myProductService"  
  55.         class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">  
  56.     <property name="transactionManager" ref="myTxManager"/>  
  57.     <property name="target" ref="myProductServiceTarget"/>  
  58.     <property name="transactionAttributes">  
  59.       <props>  
  60.         <prop key="increasePrice*">PROPAGATION_REQUIRED</prop>  
  61.         <prop key="someOtherBusinessMethod">PROPAGATION_REQUIRES_NEW</prop>  
  62.         <prop key="*">PROPAGATION_SUPPORTS,readOnly</prop>  
  63.       </props>  
  64.     </property>  
  65.   </bean>  
  66.   
  67. </beans>  
分享到:
评论

相关推荐

    spring-framework-reference4.1.4

    Not Using Commons Logging ................................................................... 12 Using SLF4J ..............................................................................................

    spring-framework-reference-4.1.2

    Not Using Commons Logging ................................................................... 12 Using SLF4J ..............................................................................................

    雪雅服饰的设计实现分析论文.doc

    It simplifies the integration of various components, handles dependency injection, and offers robust transaction management, ensuring consistent behavior across different parts of the application. ...

    基于SSM+mysql的校园二手物品交易系统微信小程序源码数据库论文.doc

    The system's functionality can include features such as user registration and authentication, item listing, searching, bidding or buying, transaction management, rating and feedback mechanisms, and ...

    Hibernate 4.1.1 API 文档

    4. **Transaction Management**:Hibernate支持JTA(Java Transaction API)和JPA(Java Persistence API)的事务管理。通过`Transaction`接口,开发者可以控制事务的开始、提交、回滚和隔离级别。 5. **Second-...

    PostgreSQL.for.Data.Architects.1783288604

    The book starts with basic concepts like installing PostgreSQL from source and covers theoretical aspects such as concurrency and transaction management. After this, you'll learn how to set up ...

    Best Practices for SAP BW on DB2 UDB for z/OS V8

    3. **Data Load Management**: Strategies for efficient data loading into the SAP BW system, including PSA (Process Data Store) management and data compression. 4. **Partitioning**: Guidance on ...

    : Algorithms, Analytics, Data, Models, Optimization

    trading strategies and algorithms, transaction costs, market impact and execution strategies, risk analysis, and management. The second part covers market impact models, network models, multi-asset ...

    Writing Testbenches using System Verilog

    Configuration Management . . . . . . . . 63 Working with Releases . . . . . . . . . . . . 65 Issue Tracking . . . . 66 What Is an Issue? . . . 67 The Grapevine System . . . . . . . . . . . . 68 ...

    EJB 持久层设计

    5. **Transaction Management**:EJB提供强大的事务管理功能,可以根据业务需求选择不同的事务隔离级别和回滚策略。容器自动管理事务,确保数据的一致性和完整性。 6. **DAO(Data Access Object)模式**:虽然不是...

    Proxy Pattern Informatization Research Based On SaaS

    then discusses basic functions, system architecture of the platform as well as metadata services, security strategies, and finally gives a multi-user data model -shared database, shared architecture....

    pjsip开发者指南中文版全部章节.pdf

    ### 内存管理策略(Memory Management Strategies) PJSIP使用内存池策略来管理内存分配,确保在应用的生命周期内,线程安全和应用的一致性。PJSIP的内存池策略通过`poolcache`机制来实现,当内存池不再使用时,它...

    hibernate_reference.pdf

    - **J2EE Application Server Integration**: Describes how to integrate Hibernate with J2EE application servers, including transaction management and JNDI bindings. #### Persistent Classes This ...

    websphere MQ中文教程

    - **事务管理** (Transaction Management): 保证消息处理的一致性和完整性。 **4.6 WebSphere MQ死信队列处理程序** - **死信队列** (Dead Letter Queue): 存储无法正常处理的消息。 - **处理程序** (Handler): ...

    Hibernate Reference Documentation3.1

    3.8.3. Current Session context management with JTA 3.8.4. JMX deployment 4. Persistent Classes 4.1. A simple POJO example 4.1.1. Implement a no-argument constructor 4.1.2. Provide an identifier ...

Global site tag (gtag.js) - Google Analytics