Top Banner
Implement distributed transations Management in the Campus System Zhuo Zeng
15
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Implement distributed transations Management in the Campus System Zhuo Zeng.

Implement distributed transations Management in the Campus Syste

mZhuo Zeng

Page 2: Implement distributed transations Management in the Campus System Zhuo Zeng.

Layers

Three layers:

1. Presentation Layer

2. Application Layer

3. Data Mapping Layer

Page 3: Implement distributed transations Management in the Campus System Zhuo Zeng.

Database

• 3 tables:

Page 4: Implement distributed transations Management in the Campus System Zhuo Zeng.

Data-Mapping

• <hibernate-mapping>• <class name="com.zz.po.User" table="[USER]" >• <id name="userid" type="java.lang.Long">• <column name="userid" />• <generator class="identity" />• </id>• <property name="username" type="java.lang.String">• <column name="username" />• </property>• <property name="password" type="java.lang.String">• <column name="password" />• </property>• <property name="truename" type="java.lang.String">• <column name="truename" />• </property>• <property name="birthday" type="java.lang.String">• <column name="birthday" />• </property>• <property name="telephone" type="java.lang.String">• <column name="telephone" />• </property>• <property name="email" type="java.lang.String">• <column name="email" />• </property>• <property name="usertype" type="java.lang.Integer">• <column name="usertype" />• </property>• <property name="lock" type="java.lang.Integer">• <column name="lock" />• </property>• </class>• </hibernate-mapping>

Page 5: Implement distributed transations Management in the Campus System Zhuo Zeng.

Strust+Spring+Hibernate

Page 6: Implement distributed transations Management in the Campus System Zhuo Zeng.

Connection Pool

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close" p:driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"p:jdbcUrl="jdbc:sqlserver://localhost:1433;databaseName=Admin"

p:user="sa" p:password="123456" p:maxPoolSize="40" p:minPoolSize="1"

p:initialPoolSize="1" p:maxIdleTime="20" />

Page 7: Implement distributed transations Management in the Campus System Zhuo Zeng.

Transaction

The simplistic view of a transaction issued to the database using SQL is as follows:

1. Begin the transaction using begin transaction command.

2. Perform various deleted, update or insert operations using SQL queries.

3. If all the operation are successful then perform commit otherwise rollback all the operations.

Page 8: Implement distributed transations Management in the Campus System Zhuo Zeng.

Transaction

• </bean>• <bean class="org.springframework.transaction.interceptor.TransactionInter

ceptor" id="transactionInterceptor">• <property name="transactionManager" ref="transactionManager"/>• <property name="transactionAttributes">• <props>• <prop key="add*">PROPAGATION_REQUIRED</prop>• <!--PROPAGATION_REQUIRED:Support a current transaction; create a new one if none exists.!->

• <prop key="modify*">PROPAGATION_REQUIRED</prop>• <prop key="update*">PROPAGATION_REQUIRED</prop>• <prop key="log*">PROPAGATION_REQUIRED</prop>• <prop key="*">PROPAGATION_SUPPORTS,readOnly</prop>• <!--PROPAGATION_SUPPORTS:Support a current transaction, execute non-transactionally if none exists.!-->

• </props>• </property>• </bean>

Page 9: Implement distributed transations Management in the Campus System Zhuo Zeng.

Login

Page 10: Implement distributed transations Management in the Campus System Zhuo Zeng.

Administrator

Page 11: Implement distributed transations Management in the Campus System Zhuo Zeng.

Student Management

Page 12: Implement distributed transations Management in the Campus System Zhuo Zeng.

Teacher Management

Page 13: Implement distributed transations Management in the Campus System Zhuo Zeng.

Course Management

Page 14: Implement distributed transations Management in the Campus System Zhuo Zeng.

Teacher Management System

Page 15: Implement distributed transations Management in the Campus System Zhuo Zeng.

Student Management System