XML of jotm

Source: Internet
Author: User

<? 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: context = "http://www.springframework.org/schema/context"
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.5.xsd
Http://www.springframework.org/schema/context
Http://www.springframework.org/schema/context/spring-context-2.5.xsd
Http://www.springframework.org/schema/aop
Http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
Http://www.springframework.org/schema/tx
Http://www.springframework.org/schema/tx/spring-tx-2.5.xsd>

<! -- Annotation transaction-driven -->
<TX: annotation-driven transaction-Manager = "transactionmanager" proxy-target-class = "true"/>
<! --
JTA is a Java Interface Specification for standardized Distributed Transaction access proposed by Sun.
Manually encode JTA
Context context = new initialcontext ();
Usertransaction ut = (usertransaction) Context. Lookup ("javax. transaction. usertransaction ")
Ut. Commit ();
Ut. rollback ();
Java transaction API (JTA) is an advanced API independent of implementation and protocol. It enables applications and application servers to access transactions.
The JTA Specification defines only a set of Java interface definitions. The specific implementation is left to the corresponding provider for implementation. Each Java EE application server must provide support for JTA.
In addition to the JTA implementation that can be bound to various Java EE application servers, there are also several independent and mature JTA implementation products on the Java platform:
1. JTA 2, atomikos 3, JBoss transactions
Tomcat does not support JTA, so cross-Database Transaction Management is implemented using spring.
Jotm (Java open Transaction Manager) is a full-featured, open-source Independent Transaction Manager developed by the objectweb organization and fully compatible with JTA (Java transaction API)
-->
<Bean id = "jotm" class = "org. springframework. transaction. JTA. jotmfactorybean"> </bean>
<! -- JTA Transaction Manager -->
<Bean id = "transactionmanager" class = "org. springframework. transaction. JTA. jtatransactionmanager">
<! -- Specify the usertransaction attribute to reference the local jotm instance -->
<Property name = "usertransaction" ref = "jotm"/>
</Bean>
<! -- Corresponds to the xapool configuration of MySQL database construct_bank, which contains an Xa data source -->
<Bean id = "constructds" class = "org. enhydra. JDBC. Pool. standardxapooldatasource">
<Property name = "datasource">
<! -- Configure the MySQL database for the internal XA data source -->
<Bean class = "org. enhydra. JDBC. Standard. standardxadatasource">
<Property name = "transactionmanager" ref = "jotm"/>
<Property name = "drivername" value = "com. MySQL. JDBC. Driver"/>
<Property name = "url" value = "JDBC: mysql: // 127.0.0.1: 3306/construct_bank"/>
</Bean>
</Property>
<Property name = "user" value = "root"/>
<Property name = "password" value = "root"/>
</Bean>
<Bean id = "sessionfactory_constructbank" class = "org. springframework. hibernate3.localsessionfactorybean">
<Property name = "datasource">
<Ref bean = "constructds"/>
</Property>
<Property name = "hibernateproperties">
<Props>
<Prop key = "hibernate. dialect"> org. hibernate. dialect. mysqldialect </prop>
<Prop key = "hibernate. hbm2ddl. Auto"> Update </prop>
<Prop key = "hibernate. show_ SQL"> true </prop>
<Prop key = "hibernate. format_ SQL> true </prop>
</Props>
</Property>
<Property name = "mappingresources">
<List>
<Value> ORG/oneedu/pojo/user. HBM. xml </value>
<Value> ORG/oneedu/pojo/card. HBM. xml </value>
</List>
</Property>
</Bean>
<Bean id = "businessds" class = "org. enhydra. JDBC. Pool. standardxapooldatasource">
<Property name = "datasource">
<! -- Internal XA data source configuration Mysql Data source -->
<Bean class = "org. enhydra. JDBC. Standard. standardxadatasource">
<Property name = "transactionmanager" ref = "jotm"/>
<Property name = "drivername" value = "com. MySQL. JDBC. Driver"/>
<Property name = "url" value = "JDBC: mysql: // 127.0.0.1: 3306/business_bank"/>
</Bean>
</Property>
<Property name = "user" value = "root"/>
<Property name = "password" value = "root"/>
</Bean>
<Bean id = "sessionfactory_businateank" class = "org. springframework. Orm. hibernate3.localsessionfactorybean">
<Property name = "datasource">
<Ref bean = "businessds">
</Property>
<Property name = "hibernateproperties">
<Props>
<Prop key = "hibernate. dialect"> org. hibernate. dialect. mysqldialect </prop>
<Prop key = "hibernate. hbm2ddl. Auto"> Update </prop>
<Prop key = "hibernate. show_ SQL"> true </prop>
<Prop key = "hibernate. format_ SQL"> true </prop>
<Props>
</Property>
<Property name = "mappingresources">
<List>
<Value> ORG/oneedu/pojo/user2.hbm. xml </value>
<Value> ORG/oneedu/pojo/card2.hbm. xml </value>
</List>
</Property>
</Bean>
<Bean id = "hibernatetemplate_constructbank" class = "org. springframework. Orm. hibernate3.hibernatetemplate">
<Property name = "sessionfactory">
<Ref local = "sessionfactory_constructbank"/>
</Property>
</Bean>
<Bean id = "hibernatetemplate_constructbank" class = "org. springframework. Orm. hibernate3.hibernatetemplate">
<Property name = "sessionfactory">
<Ref local = "sessionfactory_businessbank"/>
</Property>
</Bean>
</Beans>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.