Spring Tutorials

Spring Tutorial

Introduction of Spring Framework

Advantages and Disadvantages of Spring Framework

Features of Spring Framework

Basic concept of Spring Framework

Architecture of Spring Framework

Modules of Spring Framework

Goal of Spring Framework

Create Application of Spring without any IDE

Create Application of Spring in Eclipse IDE

Create Application of Spring in MYEclipse IDE

Important JAR of Spring Framework

IOC container in Spring Framework

Bean and Applicationcontext container in Spring Framework

Example of Spring BeanFactory Container in Spring Framework

Example of Spring ApplicationContext Container in Spring Framework

Bean in Spring Framework

Lifecycle of Bean in Spring Framework

Scope of Bean in Spring Framework

Autowiring in Spring Framework

Dependency Injection in Spring Framework

Constructor-based Dependency Injection Example in Spring Framework

Setter-based Dependency Injection Example in Spring Framework

Introduction of AOP in Spring Framework

Core concept and Goal of AOP in Spring Framework

AOP Proxies in Spring framework

XML Schema Based AOP in Spring Framework

AOP Xml based Configuration Example in Spring Framework

Example of Declaring AOP Advices in Spring Framework

AOP AspectJ Annotation with Example in Spring Framework

Declaring an aspect and pointcut using Annotation in Spring Framework

Declaring AOP Advices using Annotation Example in Spring Framework

DAO support in Spring Framework

Introduction of Spring JDBC Framework in Spring Framework

Introduction of Spring JdbcTemplate in Spring Framework

Example of Spring JdbcTemplate class in Spring framework

Example of Executing SQL statements in Spring Framework

Example of Executing DDL statements in Spring Framework

SQL Stored Procedure in Spring Framework

Example of NamedParameterJdbcTemplate in Spring Framework

Example of RowMapperJdbcTemplate in Spring Framework

Introduction of ORM Framework in Spring Framework

Integration of Spring with Hibernate in Spring Framework

Integration of Spring with JPA in Spring Framework

Introduction of Spring Expression Language (SpEL) in Spring Framework

Example of Spring Expression Language (SpEL) in Spring framework

Example of Spring EL in XML and Annotation in Spring Framework

Language Reference with SpEL in Spring Framework

Operators in Spring Expression Language(SpEL) in Spring Framework

Variable in Spring Expression Language(SpEL) in Spring Framework

Introduction of Spring Framework Transaction Management in Spring Framework

Spring Framework Transaction Abstraction

Spring Declarative Transaction Management in Spring Framework

Spring Programmatic Transaction Management in Spring Framework

Introduction of Spring OXM (Object XML Mapping) in Spring Framework

Integration of Spring with Jaxb Example in Spring framework

Example of Spring with Xstream in Spring Framework

Example of Spring with Castor in Spring Framework

Remote Method Invocation(RMI) in Spring Framework

Spring and RMI Integration with Example in Spring Framework

Example of Spring and Httpinvoker in Spring Framework

Example of Spring and Hessian in Spring Framework

Integration of Spring with JMS in Spring Framework

Introduction of Webservice in Spring Framework

Spring Web Services in Spring Framework

Web Services with Jax-WS in Spring framework

Exposing and Exporting servlet-based Web Services using JAX-WS in Spring Framework

Accessing Web Services using JAX-WS in Spring Framework

Introduction of JMS in Spring Framework

JMS Messaging Models in Spring Framework

Using Spring JMS in Spring Framework

Sending and Receiving a Message Using JMS API in Spring Framework

Introduction of JMX (Java Management Extension) in Spring Framework

Integrating Beans with JMX in Spring Framework

Creating a MBeanServer in Spring Framework

Introduction Java Mail with Spring in Spring Framework

Example of Java Mail with spring in Spring Framework

Introduction of EJB(Enterprise JavaBeans) in Spring Framework

Introduction of EJB(Enterprise JavaBeans) Integration in Spring Framework

Integration of Spring With Struts 2 Example in Spring Framework

Spring MVC

Spring MVC

adplus-dvertising
Introduction of Spring Framework Transaction Management
Previous Home Next

The Sequence of action that will be performed to complete database operation is called transaction and its management is known as Transaction Management. All these action in combination will be treated as ONE action only. Transaction management is an important part of RDBMS oriented enterprise applications to ensure data integrity and consistency.

The concept of transactions can be described with following four key properties described as ACID:

  1. Atomicity: A transaction should be treated as a single unit of operation which means either the entire sequence of operations is successful or unsuccessful.
  2. Consistency: This represents the consistency of the referential integrity of the database, unique primary keys in tables etc.
  3. Isolation: There may be many transactions processing with the same data set at the same time, each transaction should be isolated from others to prevent data corruption.
  4. Durability: Once a transaction has completed, the results of this transaction have to be made permanent and cannot be erased from the database due to system failure.

A real RDBMS database system will consider all the four properties for each transaction. The simple view of a transaction issued to the database using SQL is following as:

  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.
Advantages of the Spring Framework’s Transaction Management

The Spring Framework provides a consistent abstraction for transaction management that shows the following benefits:

  1. Consistent programming model across different transaction APIs such as Java Transaction API (JTA), JDBC, Hibernate, Java Persistence API (JPA), and Java Data Objects (JDO).
  2. Support for declarative transaction management.
  3. Simpler API for programmatic transaction management than complex transaction APIs such as JTA.
  4. Excellent integration with Spring’s data access abstractions.
  5. Use the Spring Framework’s transaction abstraction instead of EJB Container-Managed Transactions (CMT) or choosing to drive local transactions through a proprietary API such as Hibernate.
  6. Synchronizing resources with transactionsdescribes how the application code ensures that resources are created, reused, and cleaned up properly.
  7. Spring Framework’s transaction management provide Global and Local Transaction for Java EE developers .
  8. Global transactions enable you to work with multiple transactional resources, typically relational databases and message queues. Local transactions are resource-specific, such as a transaction associated with a JDBC connection. Local transactions may be easier to use.

Type of Spring Transaction Management

In J2EE, Transaction Management can be divided in two types.

  1. Global Transaction
  2. Local Transaction
Global Transaction
  1. Use to work with multiple transaction resources like RDBMS or Message Queue.
  2. Managed by Application Server (WebSphere, Weblogic) using JTA .
  3. JNDI is required to use JTA.
  4. Code can not be reused as JTA is available at server level.
  5. Example of Global Transaction: EJB CMT.
Local Transaction
  1. Use to work with specific resource (transaction associated with JDBC).
  2. Can not work across multiple transaction resource opposite to Global transaction.
  3. Most of web application uses only single resources hence it is best option to use in normal application.
Previous Home Next