Spring JPA(Hibernate) and JTA(JOTM)

Springboot+Atomikos+Jpa+Mysql实现JTA分布式事务 myeclipse开发,导入即可用,可以参阅http://www.cnblogs.com/shamo89/p/7326718.html 立即下载

 

Spring, JPA, Hibernate, and JpaTransactionManager configuration

the original configuration with a single datasource, Hibernate as the JPA provider, and the JpaTransactionManager was configured as outlined in the Spring reference manual and various posts on the web. please note that the datasource configuration within the persistence.xml JPA configuration file can be moved to the Spring configuration file as shown in this getting started with JPA in Spring 2.0 post.

persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                                 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
             version="1.0">
  <!-- transaction type set to RESOURCE_LOCAL, no JTA support -->
  <persistence-unit name="DefaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
    <properties>
      <property name="hibernate.archive.autodetection" value="class, hbm"/>
      <property name="hibernate.show_sql" value="true"/>
      <property name="hibernate.format_sql" value="true"/>
      <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
      <property name="hibernate.connection.url" value="jdbc:oracle:thin:@HOST:PORT:SID"/>
      <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
      <property name="hibernate.connection.username" value="USERNAME"/>
      <property name="hibernate.connection.password" value="PASSWORD"/>
    </properties>
  </persistence-unit>
</persistence>

spring-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                           http://www.springframework.org/schema/tx
                           http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
                           http://www.springframework.org/schema/aop
                           http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
 
  <!-- enables interpretation of the @Required annotation to ensure that dependency injection actually occures -->
  <bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/>  
 
  <!-- enables interpretation of the @PersistenceUnit/@PersistenceContext annotations providing convenient
       access to EntityManagerFactory/EntityManager -->
  <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
 
  <!-- uses the persistence unit defined in the META-INF/persistence.xml JPA configuration file -->
  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"/>
 
  <!-- transaction manager for use with a single JPA EntityManagerFactory for transactional data access
       to a single datasource -->
  <bean id="jpaTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
      <property name="entityManagerFactory" ref="entityManagerFactory"/>
  </bean>
 
  <!-- enables interpretation of the @Transactional annotation for declerative transaction managment
       using the specified JpaTransactionManager -->
  <tx:annotation-driven transaction-manager="jpaTransactionManager" proxy-target-class="false"/>
 
  <!-- enables interpretation of the @Configurable annotation for domain object dependency injection -->
  <aop:spring-configured/>
</beans>

Spring, JPA, Hibernate, JtaTransactionManager, and JOTM configuration

defining the XA datasources for use with the JOTM transaction manager is well documented. merely the fact that the JtaTransactionManager autodetects most JTA transaction managers but not the standalone JOTM transaction manager as documented in the JtaTransactionManager Javadoc was a bit tricky. a static accessor method is required which is the reason why the JotmFactoryBean has to be used. the object returned by the JotmFactoryBean implements both the UserTransaction and TransactionManager interface which is detected by the JtaTransactionManager implementation. it is, therefore, sufficient to supply the JotmFactoryBean merely to the userTransaction property of the JtaTransactionManager and not necessary to specify another reference to the transactionManager property.

once i had the XA datasources and the JtaTransactionManager in place the tricky part was to replace the JpaTransactionManager with the newly defined JtaTransactionManager and to configure the Hibernate JPA provider accordingly to make it participate in JTA transactions. Spring offers two ways to setup the JPA EntityManagerFactory. i switched the configuration to the more powerful LocalContainerEntityManagerFactoryBean and moved the properties previously defined in the persistence.xml JPA configuration file to the Spring configuration. furthermore, i replaced the datasource definition with a reference to the XA datasource and implemented a custom PersistenceUnitPostProcessor to be able to specify the JTA capable datasource directly within the Spring configuration file. in addition, setting the jpaPropertyMap property of the LocalContainerEntityManagerFactoryBean correctly to tell Hibernate to use the JOTM JTA transaction manager is necessary.

please note that a number of optional configuration properties can be supplied to Hibernate via the jpaPropertyMap. make sure to read and understand the sections on transaction strategy configuration, current session context management with JTA, and contextual sessions and set the corresponding configuration properties according to your needs.

in our current scenario we require JPA access to one of the XA datasources while JDBC is used to access the other datasource. that's the reason why no entity manager factory is defined for the second datasource. it should, however, be possible to adapt the configuration shown below and configure entity manager factories for both XA datasources.

persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                                 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
             version="1.0">
  <!-- transaction type set to JTA, transaction suspension and XA supported -->
  <persistence-unit name="SpringConfiguredPersistenceUnit" transaction-type="JTA"/>
</persistence>

spring-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                           http://www.springframework.org/schema/tx
                           http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
                           http://www.springframework.org/schema/aop
                           http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
 
  <!-- enables interpretation of the @Required annotation to ensure that dependency injection actually occures -->
  <bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/>  
 
  <!-- enables interpretation of the @PersistenceUnit/@PersistenceContext annotations providing convenient
       access to EntityManagerFactory/EntityManager -->
  <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
 
  <!-- first XA data source -->
  <bean id="bdbInnerDataSource" class="org.enhydra.jdbc.standard.StandardXADataSource">
    <property name="transactionManager" ref="jotm"/>
    <property name="driverName" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@HOST:PORT:SID"/>
    <property name="user" value="USERNAME"/>
    <property name="password" value="PASSWORD"/>
  </bean>
 
  <!-- first XA data source pool -->
  <bean id="bdbDataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">
    <property name="transactionManager" ref="jotm"/>
    <property name="dataSource" ref="bdbInnerDataSource"/>
    <property name="user" value="USERNAME"/>
    <property name="password" value="PASSWORD"/>
    <property name="maxSize" value="4"/>
  </bean>
 
  <!-- second XA data source -->
  <bean id="bpeInnerDataSource" class="org.enhydra.jdbc.standard.StandardXADataSource">
    <property name="transactionManager" ref="jotm"/>
    <property name="driverName" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@HOST:PORT:SID"/>
    <property name="user" value="USERNAME"/>
    <property name="password" value="PASSWORD"/>
  </bean>
 
  <!-- second XA data source pool -->
  <bean id="bpeDataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">
    <property name="transactionManager" ref="jotm"/>
    <property name="dataSource" ref="bpeInnerDataSource"/>
    <property name="user" value="USERNAME"/>
    <property name="password" value="PASSWORD"/>
    <property name="maxSize" value="4"/>
  </bean>
 
  <!-- required cos the standalone JOTM transaction manager is not autodetected by the
       JtaTransactionManager cos it requires a static accessor method -->
  <bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/>
 
  <!-- supplying the JotmFactoryBean merely to the userTransaction property cos JtaTransactionManager
       autodetects that the object returned by the JotmFactoryBean implements both the
       UserTransaction and the TransactionManager interface -->
  <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="userTransaction" ref="jotm"/>
    <property name="allowCustomIsolationLevels" value="true"/>
  </bean>  
 
  <!-- settings previously specified in the persistence.xml JPA configuration file are now defined with the
       LocalContainerEntityManagerFactoryBean configuration -->  
  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">    
    <!-- reference to the XA datasource -->
    <property name="dataSource" ref="bdbDataSource"/>
    <!-- specify Hibernate as the the JPA provider -->
    <property name="jpaVendorAdapter">
      <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="showSql" value="true"/>
        <property name="generateDdl" value="false"/>
        <property name="database" value="ORACLE"/>
        <property name="databasePlatform" value="org.hibernate.dialect.OracleDialect"/>
      </bean>
    </property>
    <!-- configure Hibernate to participate in JTA transactions using the JOTM transaction manager and
         specify further Hibernate specific configuration properties -->
    <property name="jpaPropertyMap">
      <map>
        <entry key="hibernate.transaction.manager_lookup_class"
               value="org.hibernate.transaction.JOTMTransactionManagerLookup"/>
        <entry key="hibernate.transaction.flush_before_completion"
               value="true"/>
        <entry key="hibernate.transaction.auto_close_session"
               value="true"/>
        <entry key="hibernate.current_session_context_class"
               value="jta"/>
        <entry key="hibernate.connection.release_mode"
               value="auto"/>                            
      </map>
    </property>
    <!-- specify that the Hibernate JPA dialect should be used, probably not necessary since 
         HibernateJpaVendorAdapter will most likely set this property -->
    <property name="jpaDialect">
      <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
    </property>
    <!-- custom implementation to enrich the PersistenceUnitInfo read from the persistence.xml
         JPA configuration file with the JTA datasource. specifying the JTA datasource directly in
         the Spring configuration file has the advantage that we can use a direct reference to the
         datasource instead of using a JNDI name as requied by the jta-data-source setting in the
         persistence.xml file -->
    <property name="persistenceUnitPostProcessors">
      <bean class="sample.JtaPersistenceUnitPostProcessor">
        <property name="jtaDataSource" ref="bdbDataSource"/>		
      </bean>
    </property>
  </bean>
 
  <!-- enables interpretation of the @Transactional annotation for declerative transaction managment
       using the specified JtaTransactionManager -->
  <tx:annotation-driven transaction-manager="jtaTransactionManager" proxy-target-class="false"/>
 
  <!-- enables interpretation of the @Configurable annotation for domain object dependency injection -->
  <aop:spring-configured/>
</beans>

sample.JtaPersistenceUnitPostProcessor.java

package sample;
 
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo;
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor;
 
/**
 * the {@link JtaPersistenceUnitPostProcessor} enables us to define the JTA capable datasource
 * which should be used by the JPA provider directly as a reference within the Spring configuration
 * file.
 */
public class JtaPersistenceUnitPostProcessor implements PersistenceUnitPostProcessor {
  /**
   * a reference to the JTA capable datasource which is add to the PersistenceUnitInfo during post
   * processing instead of beeing specified using the "jta-data-source" setting in the persistence.xml
   * configuration file
   */
  private DataSource jtaDataSource;
 
  /**
   * enrich the PersistenceUnitInfo read from the persistence.xml configuration file with a reference
   * to the jtaDataSource injected via the Spring configuration. the JTA capable datasource is then
   * used by the LocalContainerEntityManagerFactoryBean to create the EntityManagerFactory
   *
   * @see PersistenceUnitPostProcessor#postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo)
   */
  public void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo mutablePersistenceUnitInfo) {
    mutablePersistenceUnitInfo.setJtaDataSource(getJtaDataSource());
  }
 
  /**
   * getter for jtaDataSource
   * 
   * @return the JTA capable datasource supplied via the setter
   */
  public DataSource getJtaDataSource() {
    return jtaDataSource;
  }
 
  /**
   * setter for jtaDataSource 
   *
   * @param jtaDataSource the JTA capable datasource added to the PersistenceUnitInfo during post processing
   */
  @Required
  public void setJtaDataSource(DataSource jtaDataSource) {
    this.jtaDataSource = jtaDataSource;
  }
}

if you don't want to implement and use a custom PersistenceUnitPostProcessor you can add the jta-data-source setting to the persistence-unit configuration in the persistence.xml file. add the following snippet and specify the JNDI name to the JTA capable datasource:

<jta-data-source>jdbc/bdbDataSource</jta-data-source>

you will then have to expose the JTA datasource via JNDI which can be achieved by using the XBean library and adding the following snippet to the spring-context.xml file:

<bean id="jndiContext" class="org.apache.xbean.spring.jndi.SpringInitialContextFactory"
      factory-method="makeInitialContext" scope="singleton" lazy-init="false">                
  <property name="entries">
    <map>
      <entry key="jdbc/bdbDataSource" value-ref="bdbDataSource"/>
    </map>
  </property>
</bean>

if you plan to use a JTA transaction manager other than the standalone JOTM transaction manager you will have to adapt the XA datasource configuration, most likely use the autodetect mode of the JtaTransactionManager by removing the JotmFactoryBean (or specifying another factory bean), and define a different hibernate transaction manager lookup class. for in container deployment you will most likely want to use the JndiObjectFactoryBean to integrate the datasources already configured within the application server into the Spring application context (by simply specifying the JNDI name).

华为交换机实战:如何用ACL+流分类精准限制特定IP的网速(附完整命令) 本文详细介绍了华为交换机如何通过ACL+流分类技术实现精准IP限速,包括ACL规则配置、流分类关联、流行为定义及流策略应用等完整步骤。文章提供了实战命令和配置验证方法,帮助网络管理员有效管理带宽资源,解决特定IP占用过多带宽的问题。 阅读详情

相关推荐

物理学建模及仿真平台Chrono安装

Chrono是一个基于物理学的建模和仿真基础设施,它是在C++中实现的独立于平台的开源设计。一个projectchrono库可以嵌入到一个软件项目中,例如在可变形地形上运行的轮式和履带式车辆、机器人、机械电子系统、顺应性机构和流体固体相互作用现象。系统可以由刚性和柔性/顺应性部件组成,并带有约束、电机和接触;部件可以具有三维形状,以便进行碰撞检测。然而安装还是出现了一些问题,所以在此总结。已经装好visual studio。

Already8888的博客 6500

Spring事务管理(详解+实例)

写这篇博客之前我首先读了《Spring in action》,之后在网上看了很多关于Spring事务管理的文章,具体参考文章如下: 1、将相应的接口依赖图理清出 2、将每个类的具体配置弄明白 3、将具体的配置给出来 4、给出具体的例子(一个声明式的一个编程式的)

Trigl的博客 9万+

【CTFhub】——hate_php2021

【CTFhub】——hate_php2021

manerzi的博客 1604

jta+spring4+hibernate5/jpa2

spring配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con...

dengluan0964的博客 191

5G边缘计算:核心网下沉革命

5G核心网与边缘计算的深度融合,通过UPF下沉、本地流量卸载等关键技术,实现了低时延、高效能的分布式计算架构。该技术将数据处理从核心网向边缘节点转移,支持工业控制、车联网、远程医疗等场景的1-10ms超低时延需求。5G核心网的SBA架构和CUPS设计为边缘计算提供了灵活部署基础,SMF、PCF等网元协同确保业务质量与可靠性。

Qinti_mm的博客 1399

传输线的特征阻抗

信号源内阻与所接传输线的特性阻抗大小相等且相位相同,或传输线的特性阻抗与所接负载阻抗的大小相等且相位相同,分别称为传输线的输入端或输出端处于阻抗匹配状态,简称为阻抗匹配。否则,便称为阻抗失配。有时也直接叫做匹配或失配。指一个电路输入端的等效阻抗。在输入端上加上一个电压源U,测量输入端的电流I,则输入阻抗Rin就是U/I。可以把输入端想象成一个电阻的两端,这个电阻的阻值,就是输入阻抗。- 对于电压驱动的电路,输入阻抗越大,则对电压源的负载就越轻,因而就越容易驱动,也不会对信号源有影响;

学海无涯的专栏 4462

多数据源模拟分布式事务之SpringBoot+Jta-Atomikos+Jpa

0.实体类 package com.example.jta.entity.db1; import lombok.Data; import javax.persistence.*; @Entity @Table(name = "goods") @Data public class Goods { @Id @GeneratedValue(strategy= GenerationType.IDENTITY) private Long id; private Strin

LuckFairyLuckBaby的博客 741

HWDB1.1数据集处理全攻略:从gnt文件到PNG图片的完整转换教程

本文提供了HWDB1.1数据集处理的完整教程,详细解析了gnt二进制文件格式,并给出了从文件解析、标签映射到批量转换为PNG图片的Python脚本。教程涵盖了环境准备、跨平台解压方案,以及为PyTorch等深度学习框架准备数据的最佳实践,是进行手写汉字识别研究不可或缺的实用指南。

2w3e4r5t6y的博客 627

SpringBoot之JPA框架下如何使用JTA——分布式事务解决方案

本篇博客的精髓,在于实现Springboot框架下的分布式事务。

wangzhezhilu001的专栏 1204

【即插即用模块】注意力篇 | TGRS 2025 | ASD:自适应频域解耦,动态拆分高低频+空间注意力,频域空间特征双增强!

摘要: FDMF-Net提出了一种频域解耦多模态融合网络,核心组件为振幅谱解耦模块(ASD)。ASD通过自适应频域拆分和频域-空域协同增强,有效分离模态不变与模态特定特征。该模块利用MLP学习动态阈值调整高低频比例,并通过空间注意力分别强化频域特征,在遥感语义分割任务中实现了细节与结构的协同增强。实验表明,ASD模块能减少模态内冗余,提升特征判别性,为多模态数据融合提供了新思路。代码已开源,适用于需要强化细节与结构的视觉任务。

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 304

Go语言全面解析:从入门到精通

Go语言是由Google开发的一种静态类型、编译型编程语言,具有简洁、高效、安全的特点。它特别适合高并发服务、云原生应用和网络编程等场景。Go采用Goroutine和Channel实现轻量级并发,性能接近C/C++。与其他语言相比,Go语法更简洁但类型更严格,编译速度快且跨平台支持好。虽然Go支持多种设计模式和编程范式,但其面向对象实现方式与传统语言不同。标准库丰富且拥有Gin、GORM等企业级框架。核心语法包括包管理、变量声明、函数定义、流程控制等,适合构建高性能后端服务和系统工具。

博哥哥的博客 4925

Spring, JPA, and JTA with Hibernate and JOTM

[url]http://erich.soomsam.net/2007/04/24/spring-jpa-and-jta-with-hibernate-and-jotm/[/url] have been struggling for a couple of hours today to modify a Spring JPA configuration with a single dataso...

win_yee的专栏 201

STM32入门教程:智能储物柜控制

在这个例子中,我们将使用一个4x4的储物柜,共有16个储物格。我们了解了硬件准备、储物柜电路设计、STM32的基本配置、储物柜控制代码的编写以及测试和调试等方面的知识。根据我们的电路设计,我们需要将一些引脚配置为输出,并将其他引脚配置为输入。在本教程中,我们将使用STM32微控制器来实现一个基本的智能储物柜控制系统。在主函数中,我们将不断循环读取传感器数据,并根据数据的变化来控制储物柜的开关和显示相关信息。这个函数将读取人体感应传感器、温湿度传感器和光照传感器的数据,并将数据存储到相应的变量中。

m0_75244442的博客 658

jotm + spring

前段时间在网上看到一位仁兄用spring和jotm做应用,觉得配置文件可收藏,供以后使用时参考: &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-...

qingwei201314 122

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

JTA分布式事务实践

最近一直在研究怎么实现分布式事务,花了不少时间,测试工程启停测试了无数次,最终实现的时候其实也就是写一些配置文件,对于工程代码没什么影响。目前研究还不是很深入,对于全面崩溃恢复如何实现和测试还不清楚。本文先介绍基础的实现。   当业务需要在一个事务中操作多个不同的资源,例如多个数据库,消息队列,缓存等,那么就需要使用分布式事务了。在java中一般建议使用JTA,这样开发人员就不用关心什么叫...

hzy0769的博客 503

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

用Spring集成的JOTM配置分布式事务,结合hibernate jpa

最近项目中涉及到了两个Oracle数据库的操作。需要用到分布式事务,研究之后贴出代码供大家参考。 1.dao-core.xml(核心事务配置XML) [code="java"] ...

iteye_17017的博客 226

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Spring源码之事物 Transaction官方文档翻译

官方文档地址: https://docs.spring.io/spring/docs/4.3.21.RELEASE/spring-framework-reference/htmlsingle/#transaction 介绍Spring框架事务管理 全面的事务支持是使用Spring框架的最令人信服的原因之一。Spring框架为事务管理提供了一致的抽象,提供了以下好处: 跨不同事务API(如J...

AnY11的专栏 1968

1.事务管理

1.事务管理 全面的事务支持是使用Spring Framework的最令人信服的原因。Spring框架为事务管理提供了一致的抽象,具有以下优点: 跨不同事务API(例如Java事务API(JTA),JDBC,Hibernate和Java Persistence API(JPA))的一致编程模型。 支持声明式事务管理。 与诸如JTA之类的复杂事务API相比,用于程序化事务管理的API更简单。 与Spring的数据访问抽象的出色集成。 以下各节描述了Spring框架的事务功能和技术: S

weixin_43981133的博客 188

Spring —— 生成EntityManagerFactory 的 3 种方式

1.LocalEntityManagerFactoryBean 只是简单环境中使用。它使用JPA PersistenceProvider自动检测机制( according to JPA's Java SE bootstrapping ),并且大多数情况下,你只能定义一下persistence unit name 例: <bean id

永远的北极光 3493

JPA & XA

After I wrote a blog about Spring &amp; JPA settings: http://jellyfish.iteye.com/admin/blogs/899281, a friend asked me a question about XA on JPA.   Last time I did XA was the year 2002, so I figure...

jellyfish 378

spring5.1.3使用篇-数据访问

spring的事务管理支持及集成的各种数据库访问框架和技术

神武舞 1492

@Transactional Spring Annotation in a Struts2 Action

最近因为要做一个有关Transaction的Knowledge share, 我实现了一个 "Client Owner Transaction" 的sample。 基本原理是根据 Mark Richards article. 基本原理由客户端控制Transaction的start/commit/rollback, Transaction Context将被传到Service Layer

Tony 的专栏 1962

JavaEE事务扫盲笔记之一扫扫到尾

音箱里放的是《暮良文王》、《相相生》,再看下面的笔记体,虽然实用,但还是数完盘来再数碟,言语无味的很。以后不是这里的地荒得太厉害,就尽量让这些笔记在wiki里安静的呆着吧。1.资料 《Java Transaction Design Strategies》  InfoQ minibook,最好的电子文档,对Java事务处于懵懂状态的必读。 《Expert One on one J2EE

软件开发资料汇总 301

spring framework-数据访问

这部分文档关于数据访问以及数据访问层和业务或服务层的交互。 Spring提供了全面的事务管理支持,并详细介绍了Spring框架集成的各种数据访问框架和技术。 事务管理 全面的事务支持是使用Spring Framework的最有说服力的原因之一。Spring Framework为事务管理提供一致性抽象,有下列好处: 一致性编程模型横跨不同的事务API,比如Java事务API(JTA),JDBC,H...

ssehs的博客 362

Spring 数据入口(第一部分)

参考文档的这一部分涉及数据访问和数据访问层与业务或服务层之间的交互。 本文详细介绍了Spring的全面事务管理支持,然后全面介绍了Spring框架集成的各种数据访问框架和技术。 1. 事务管理 全面的事务支持是使用Spring框架的最重要原因之一。Spring框架为事务管理提供了一致的抽象,提供了以下好处: 跨不同事务API(如Java事务API (JTA)、JDBC、Hibernate和Ja...

qq_33642970的博客 735
上一篇: 美最有价值博客排名 Gawker1.7亿美元夺魁
下一篇: JBoss Developer Studio 2.0发布了
wwwtyb
博客等级 码龄19年 33粉丝 24原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值