SlideShare a Scribd company logo
1 of 39
Transaction Management Session 9
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Session Objectives
Review of Session 8 (1) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Review of Session 8 (2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Common Problems Atomic  Operations Network or Machine Failure Transaction Problems Multiple  users sharing data
Atomic Operations Operation Total + + ,[object Object],[object Object],[object Object],Operation 1 Operation 3 Operation 2
Network or Machine Failure ,[object Object],Network Crash Loss of data
Multiple Users Sharing Data Database ,[object Object]
Transaction Definition ,[object Object],Series of Operations Committed Transaction All or None
Terminologies in Transactions ,[object Object],[object Object],[object Object],[object Object]
The ACID properties Operations in transactions  Atomicity Consistency Isolation Durability
Atomicity Operation 3 Operation 2 Operation 1 Fails Fails Fails Entire Transaction Fails
Consistency Transaction Consistency ensures that  the state is consistent ,[object Object]
Isolation ,[object Object]
Durability ,[object Object],Durability Network Failure Survived Failure
Transactional Models ,[object Object],[object Object],Nested Transactions Transactional  models Flat  Transactions
Flat Transactions Operation 1 Operation 4 Operation 3 Operation 2 Executed as  one unit of work
Nested Transactions Transaction1 Transaction2 ,[object Object],[object Object],[object Object],Transaction3
Programmatic and Declarative Transactions  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transaction Isolation Levels TRANSACTION_READ_UNCOMMITED mode TRANSACTION_READ_COMMITTED mode TRANSACTION_REPEATABLE_READ mode Transaction Levels TRANSACTION_SERIALIZABLE   mode
Isolation Problems in EJB-I ,[object Object],[object Object],[object Object]
Isolation Problems in EJB-II The Dirty Read  Problem The Phantom  Problem The Unrepeatable  Read Problem Transactional Isolation Problems  TRANSACTION_READ_COMMITTED   TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE
Distributed Transactions The Transactional Cover Application  server1 Application server2 ,[object Object]
Durability and Two phase Commit protocol PHASE I Before commit  Message Last chance to perform abort statement  Abort Yes No Transaction Continues Transaction Aborted Phase II Actual data updates are performed by resource managers RESOURCES Transactions
Steps in the Two-Phase Commit Statement Transaction  coordinator 1. Prepare to commit statement Resource Manager 2.   Message is passed to resource managers asking if they are ready to commit 3.  Everyone agrees to commit Once the three steps given in the diagram are completed, the transaction coordinator asks the transaction managers  to commit. This is passed on to the resource manager, which makes all resource updates permanent. Transaction Manager Transaction Manager
Transactional Communications Protocol and Transaction Contexts   ,[object Object],[object Object],[object Object]
CORBA’s Object Transaction Service ( OTS ) CORBA’s OTS  CosTransactions in terface CosTSPortability  interface
CORBA’s Object Transaction Service ( OTS ) ,[object Object],[object Object],[object Object],[object Object],[object Object]
The Java Transaction Service (JTS) Java  Transactional  Service Defines interfaces  which are used by the transaction and resource managers Many objects are passed around  and used by the transaction and resource managers
Java Transaction API (JTA) JTA Starts a transaction inside a bean Call other beans which are involved in a transaction Controls the commit and abort processes
Controlling Transactions from Client Code   ,[object Object],[object Object],[object Object]
Designing Transactional Conversations in EJB  Uncommitted database Aborted  Transaction Rollback of the updates is performed Exception is  thrown The client
Session Synchronization methods ,[object Object],[object Object],[object Object]
Transaction Attributes  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Container-Managed Transaction Demarcation for Session and Entity Beans ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Container-Managed Transaction for Message-Driven Beans   ,[object Object],[object Object],[object Object],[object Object]
Summary (1) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary (2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary (3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

Viewers also liked

7 distributed and real systems
7 distributed and real systems7 distributed and real systems
7 distributed and real systems
myrajendra
 
Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)
Sri Prasanna
 

Viewers also liked (9)

Back-End application for Distributed systems
Back-End application for Distributed systemsBack-End application for Distributed systems
Back-End application for Distributed systems
 
(Slides) A Method for Distributed Computaion of Semi-Optimal Multicast Tree i...
(Slides) A Method for Distributed Computaion of Semi-Optimal Multicast Tree i...(Slides) A Method for Distributed Computaion of Semi-Optimal Multicast Tree i...
(Slides) A Method for Distributed Computaion of Semi-Optimal Multicast Tree i...
 
Applications of Distributed Systems
Applications of Distributed SystemsApplications of Distributed Systems
Applications of Distributed Systems
 
Distributed systems
Distributed systemsDistributed systems
Distributed systems
 
7 distributed and real systems
7 distributed and real systems7 distributed and real systems
7 distributed and real systems
 
Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)
 
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
 
Distributed Systems Real Life Applications
Distributed Systems Real Life ApplicationsDistributed Systems Real Life Applications
Distributed Systems Real Life Applications
 
NETWORK PROTOCOL
NETWORK PROTOCOLNETWORK PROTOCOL
NETWORK PROTOCOL
 

Similar to Session 9 Tp9

Session 2 Tp2
Session 2 Tp2Session 2 Tp2
Session 2 Tp2
phanleson
 
Topic2 Understanding Middleware
Topic2 Understanding MiddlewareTopic2 Understanding Middleware
Topic2 Understanding Middleware
sanjoysanyal
 
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docxDBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
randyburney60861
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011
sumit_study
 
Intro to database systems homework questions- 1- List the ACID propert.docx
Intro to database systems homework questions- 1- List the ACID propert.docxIntro to database systems homework questions- 1- List the ACID propert.docx
Intro to database systems homework questions- 1- List the ACID propert.docx
olsenlinnea427
 

Similar to Session 9 Tp9 (20)

Transaction handling in com, ejb and .net
Transaction handling in com, ejb and .netTransaction handling in com, ejb and .net
Transaction handling in com, ejb and .net
 
Session 2 Tp2
Session 2 Tp2Session 2 Tp2
Session 2 Tp2
 
DBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency Control
 
Spring Transaction Management
Spring Transaction ManagementSpring Transaction Management
Spring Transaction Management
 
Topic2 Understanding Middleware
Topic2 Understanding MiddlewareTopic2 Understanding Middleware
Topic2 Understanding Middleware
 
Chapter 4 u
Chapter 4 uChapter 4 u
Chapter 4 u
 
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docxDBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
 
Transaction Management
Transaction ManagementTransaction Management
Transaction Management
 
Hibernate interview questions
Hibernate interview questionsHibernate interview questions
Hibernate interview questions
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011
 
Transaction
TransactionTransaction
Transaction
 
Job Opportunity
Job OpportunityJob Opportunity
Job Opportunity
 
TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6
 
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.ppt
 
Intro to database systems homework questions- 1- List the ACID propert.docx
Intro to database systems homework questions- 1- List the ACID propert.docxIntro to database systems homework questions- 1- List the ACID propert.docx
Intro to database systems homework questions- 1- List the ACID propert.docx
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
 
Web Basics
Web BasicsWeb Basics
Web Basics
 
TY.BSc.IT Java QB U5
TY.BSc.IT Java QB U5TY.BSc.IT Java QB U5
TY.BSc.IT Java QB U5
 
09 transactions new
09 transactions new09 transactions new
09 transactions new
 
EJB.docx
EJB.docxEJB.docx
EJB.docx
 

More from phanleson

Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XML
phanleson
 

More from phanleson (20)

Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Firewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth FirewallsFirewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth Firewalls
 
Mobile Security - Wireless hacking
Mobile Security - Wireless hackingMobile Security - Wireless hacking
Mobile Security - Wireless hacking
 
Authentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless ProtocolsAuthentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless Protocols
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server AttacksE-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applications
 
HBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table designHBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table design
 
HBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - OperationsHBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - Operations
 
Hbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBaseHbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBase
 
Learning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlibLearning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlib
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streaming
 
Learning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQLLearning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQL
 
Learning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a ClusterLearning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a Cluster
 
Learning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark ProgrammingLearning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark Programming
 
Learning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your DataLearning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your Data
 
Learning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value PairsLearning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value Pairs
 
Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about LibertagiaHướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
 
Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XML
 
Lecture 4 - Adding XTHML for the Web
Lecture  4 - Adding XTHML for the WebLecture  4 - Adding XTHML for the Web
Lecture 4 - Adding XTHML for the Web
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Session 9 Tp9

  • 2.
  • 3.
  • 4.
  • 5. Common Problems Atomic Operations Network or Machine Failure Transaction Problems Multiple users sharing data
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. The ACID properties Operations in transactions Atomicity Consistency Isolation Durability
  • 12. Atomicity Operation 3 Operation 2 Operation 1 Fails Fails Fails Entire Transaction Fails
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Flat Transactions Operation 1 Operation 4 Operation 3 Operation 2 Executed as one unit of work
  • 18.
  • 19.
  • 20. Transaction Isolation Levels TRANSACTION_READ_UNCOMMITED mode TRANSACTION_READ_COMMITTED mode TRANSACTION_REPEATABLE_READ mode Transaction Levels TRANSACTION_SERIALIZABLE mode
  • 21.
  • 22. Isolation Problems in EJB-II The Dirty Read Problem The Phantom Problem The Unrepeatable Read Problem Transactional Isolation Problems TRANSACTION_READ_COMMITTED TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE
  • 23.
  • 24. Durability and Two phase Commit protocol PHASE I Before commit Message Last chance to perform abort statement Abort Yes No Transaction Continues Transaction Aborted Phase II Actual data updates are performed by resource managers RESOURCES Transactions
  • 25. Steps in the Two-Phase Commit Statement Transaction coordinator 1. Prepare to commit statement Resource Manager 2. Message is passed to resource managers asking if they are ready to commit 3. Everyone agrees to commit Once the three steps given in the diagram are completed, the transaction coordinator asks the transaction managers to commit. This is passed on to the resource manager, which makes all resource updates permanent. Transaction Manager Transaction Manager
  • 26.
  • 27. CORBA’s Object Transaction Service ( OTS ) CORBA’s OTS CosTransactions in terface CosTSPortability interface
  • 28.
  • 29. The Java Transaction Service (JTS) Java Transactional Service Defines interfaces which are used by the transaction and resource managers Many objects are passed around and used by the transaction and resource managers
  • 30. Java Transaction API (JTA) JTA Starts a transaction inside a bean Call other beans which are involved in a transaction Controls the commit and abort processes
  • 31.
  • 32. Designing Transactional Conversations in EJB Uncommitted database Aborted Transaction Rollback of the updates is performed Exception is thrown The client
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.

Editor's Notes

  1. Approach: This slide is self explanatory. Details about each individual problem are addressed in subsequent slides.
  2. Approach: Imagine that you would like to perform multiple discrete operations, yet have them execute as one contiguous, large operation. Take the classic bank account example. When you transfer money from one bank account to another, you want to withdraw funds from one account and deposit those funds to the other account. Ideally, both operations will succeed. But if an error occurs, you would like to have both operations to fail. Otherwise u will have incorrect funds in one of the accounts. You would never want one operations are part of a single atomic transaction. One simple way to handle this to perform exception handling. You could use exceptions to write a banking module to transfer funds from one account to another. But there are many problems with this approach: The code is bulky and unwieldy We need to consider every possible problem that occurs at every step of the way and code error handling routines to consider how to roll back our changes. Error handling gets out of control if we perform more complex processes than a simple withdrawal and a deposit. It is easy to imagine, for example, a 10 step process that updates several financial records. We would need to code error handling routines for each step. In the case of a problem, we need to code facilities to undo each operation. This gets very tricky and error prone to write. Testing this code is another challenge. You would have to simulate logical problems as well as failures at many different levels. Ideally, we would like a way to perform both operations in a single, large atomic operation, with a guarantee that either always succeed or both will always will always fail.
  3. Approach: Let us extend our classic bank account example and assume our bank account logic is distributed across a multi-tier deployment. This may be necessary for security, scalability and modularization reasons. In a multi-tier deployment, any client code that wants to use our bank account must do so across the network via a remote method invocation. Distributing the application across a network introduces failure and reliability concerns. For example. What happens if the network crashes during a banking operation? Typically, an exception will be generated and thrown back to the client code-but this exception is quite ambiguous in nature. The network may have failed before money was withdrawn from an account. It is also possible that the network failed after we withdrew money. There is no way to distinguish between these two cases-all the client code sees is a network failure exception. Thus we can never know for sure how much money is in the bank account. In fact, the network may not be the only source of problems. Because we are dealing with bank account data, we are dealing with persistent information residing in a database. It is entirely feasible that the database itself could crash. The machine that the database is deployed could also crash. If a crash occurs during a database write, the database write, the database could be in in an inconsistent, corrupt state For a mission-critical enterprise application.
  4. Approach: The above slide describes the ACID properties. Each of these are described in subsequent slides.
  5. Approach: The slide is self explanatory. A good description of the property is given in the student guide. Every task within the transaction must execute without error. If any task fails, the entire transaction fails. If any of the tasks fails, the entire transaction is aborted, meaning that changes to the data are undone. If all the tasks execute perfectly, then the changes to the data are made durable. Let us look at an example: a TravelAgent bean. The first measure of the bean would its atomicity. Does it ensure that the transaction executes completely or not all. What we are concerned with us are the critical tasks that change or create information. Suppose there is method bookPassage(), a reservation bean is created, the ProcessPayment bean debits a credit card and a Ticket object is created. All of these tasks must be successful for the entire transaction to successful. To understand the importance of the atomic characteristic, you have to imagine what would happen if every one of the subtasks failed to execute. If for example, the creation of a Reservation failed but all other tasks succeeded, your customer will probably end up getting removed from the cruise. As far as as the travel agent is concerned, the bookPassage() method executed successfully because a Ticket was generated. If a ticket is generated without the creation of a reservation, the state of the system becomes inconsistent with reality because the customer paid for a ticket
  6. Approach: A simple explanation of the slide is given in the student guide. Consistency is a transactional characteristic that must be enforced by both the transactional system and application developer. Consistency refers to the integrity of the underlying data store. The transactional system fulfills its obligation in consistency by ensuring that a transaction is atomic, durable and isolated. The application developer must ensure that the database has appropriate constraints(primary keys, referential integrity and so forth) and that business logic doesn’t result in inconsistent data. TravelAgent bean In order for a transaction to be consistent, the state of the business system make sense after the transaction has completed. In other words, the state of the business system must be consistent with the reality of the business. This requires that the transaction enforce the atomic, isolated and durable charcteristics of the transaction, and it also requires diligent enforcement of integrity constraints by the application developer. If for example, the application developer fails to include the credit card charge operation in the bookPassage() method, the customer would be issued a ticket but charged. The data would be inconsistent with the expectation of the business-a customer should be set up to enforce integrity constraints. For example, it should not be possible for a record to be added to the RESERVATION table unless the CABIN_ID, CRUISE_ID AND CUSTOMER_ID foreign keys map to corresponding records in the CABIN, CRUISE and CUSTOMER tables, respectively. If a CUSTOMER_ID is used that doesn’t map to a CUSTOMER record, referential integrity should cause the database to throw an error message.
  7. Approach: The slide gives a graphic representation of isolation. A transaction must be allowed to execute without interference from other processes or transactions. In other words, the data that a transaction accesses cannot be affected by any other part of the system until the transaction is completed. TravelAgent bean If you are familiar with the concept of thread synchronization in Java or row locking schemes in relational databases, isolation will be a familiar concept. To be isolated, a transaction must protect the objects and data that is accessing from other transactions. This is necessary to prevent other transactions from interacting with data that is in transatition. In the TravelAgent bean, the transaction is isolate dto prevent other transactions from modifying the beans that are being updated. Imagine the problem that would arise if separate transactions were updated. Imagine the problems that would arise if separate transactions were allowed to change any time-transactions would walk all over each other. You could easily have several customers book the same cabin because their travel agent happened to make the their reservations at the same time The isolation of a process doesn’t mean that the entire application shuts down during a transaction. Only those entity beans and data directly affected by the transaction are isolated. In the TravelAgent bean, for example, the transaction isolates only the Reservation bean created. There can be many Reservation beans in existence; there is no reason other beans cant be accessed by other transactions.in EJB, we use isolation levels set in the deployment descriptor to determine the isolation characteristics of transactions.
  8. Approach: This means that all the data changes made during the course of a transaction must be written to some type of physical storage before the transaction is fully completed. This ensures that changes are not lost if the system crashes.