SlideShare uma empresa Scribd logo
1 de 31
Transactional J(2)EE Applications  with Spring Transactional POJO Programming  Guy Pardon (guy@atomikos.com)
Contents ,[object Object],[object Object],[object Object]
Part 1 Spring Essentials
The Spring  Framework ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Configuring a DataSource ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Ask Spring to create an object with this name and of this class, and to set the given properties
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],A Client Component
Wiring Objects Together  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Ask Spring to establish an association between the  Objects called bank and datasource
Bank Class: “setDataSource”  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Our Java code can now be independent of the actual JDBC vendor classes. This is called by the Spring wiring runtime.
Applications: Configuration No Longer Hard-Coded ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Just ask the Spring BeanFactory to use our XML configuration file. We can ask Spring to return configured objects by their name (id)
Spring Benefits ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transactions in Spring? ,[object Object],[object Object],[object Object],[object Object]
Part 2 Transaction Support in Spring
Spring and Transactions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transaction Strategies in Spring ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Single-Connector Strategies ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
JDBC Strategy ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Spring XML Config? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example: Declarative + JDBC Strategy (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],[object Object],Vendor-specific datasource setup. Proxy required for JDBC strategy in Spring. Our bank’s JDBC is done via the proxy.
Example: Declarative + JDBC Strategy (2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Clients of our bank will use a proxy that inserts transaction logic. Transaction required, rollback on any exception.
JTA Strategy ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example: Declarative + JTA Strategy (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],Vendor-specific datasource setup (JTA enabled class). Setup Atomikos standalone JTA.
Example: Declarative + JTA Strategy (2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Tell Spring to use the Atomikos JTA implementation.
Using Other JTA Implementations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transaction Attributes in Spring ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Part 3 JTA Use Cases
Use Case 1: From Queue to DB Avoiding message loss and duplicates requires JTA! JMS JDBC Message Queue Message Listener Order Dept. DBMS Spring Application
Use Case 2: From Queue to Queue JMS Bridge Avoiding message loss and duplicates requires JTA! JMS JMS Source Queue Target Queue
Use Case 3: From Web to DB and Queue Web Application Consistent Processing Requires JTA! JMS JDBC Message Queue Order Dept. DBMS HTTP
Use Case 4: Between 2 DBs Web Application Consistent Processing Requires JTA! JDBC JDBC Order Dept. DBMS HTTP Shipping Dept. DBMS
Conclusion: Spring Improves J2EE ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
More Information? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados (18)

Spring Framework - III
Spring Framework - IIISpring Framework - III
Spring Framework - III
 
Hibernate III
Hibernate IIIHibernate III
Hibernate III
 
Java EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's QuarrelJava EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's Quarrel
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
 
JSP Technology I
JSP Technology IJSP Technology I
JSP Technology I
 
Jdbc
JdbcJdbc
Jdbc
 
CDI @javaonehyderabad
CDI @javaonehyderabadCDI @javaonehyderabad
CDI @javaonehyderabad
 
Hibernate II
Hibernate IIHibernate II
Hibernate II
 
Spring & hibernate
Spring & hibernateSpring & hibernate
Spring & hibernate
 
Spring Framework-II
Spring Framework-IISpring Framework-II
Spring Framework-II
 
Working with Servlets
Working with ServletsWorking with Servlets
Working with Servlets
 
Utilized Code Gen To Save Our Efforts In Sap Integration
Utilized Code Gen To Save Our Efforts In Sap IntegrationUtilized Code Gen To Save Our Efforts In Sap Integration
Utilized Code Gen To Save Our Efforts In Sap Integration
 
Jpa
JpaJpa
Jpa
 
Spring framework DAO
Spring framework  DAOSpring framework  DAO
Spring framework DAO
 
Java questions with answers
Java questions with answersJava questions with answers
Java questions with answers
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Introduction to JPA Framework
Introduction to JPA FrameworkIntroduction to JPA Framework
Introduction to JPA Framework
 
Jdbc Lecture5
Jdbc Lecture5Jdbc Lecture5
Jdbc Lecture5
 

Semelhante a Developing Transactional JEE Apps With Spring

Spring Framework
Spring FrameworkSpring Framework
Spring Frameworknomykk
 
Sims4 gkce
Sims4 gkceSims4 gkce
Sims4 gkcesreeni
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesJohn Brunswick
 
Java one 2010
Java one 2010Java one 2010
Java one 2010scdn
 
SpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSUFYAN SATTAR
 
Spring MVC
Spring MVCSpring MVC
Spring MVCyuvalb
 
Ta Javaserverside Eran Toch
Ta Javaserverside Eran TochTa Javaserverside Eran Toch
Ta Javaserverside Eran TochAdil Jafri
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009marpierc
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Slobodan Lohja
 
Seam Introduction
Seam IntroductionSeam Introduction
Seam Introductionihamo
 
Windows Server AppFabric Caching - What it is & when you should use it?
Windows Server AppFabric Caching - What it is & when you should use it?Windows Server AppFabric Caching - What it is & when you should use it?
Windows Server AppFabric Caching - What it is & when you should use it?Robert MacLean
 

Semelhante a Developing Transactional JEE Apps With Spring (20)

Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Sims4 gkce
Sims4 gkceSims4 gkce
Sims4 gkce
 
I Feel Pretty
I Feel PrettyI Feel Pretty
I Feel Pretty
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server Pages
 
Java one 2010
Java one 2010Java one 2010
Java one 2010
 
Dev381.Pp
Dev381.PpDev381.Pp
Dev381.Pp
 
SpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptx
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
 
Data access
Data accessData access
Data access
 
Jsp 01
Jsp 01Jsp 01
Jsp 01
 
Os Johnson
Os JohnsonOs Johnson
Os Johnson
 
JEE5 New Features
JEE5 New FeaturesJEE5 New Features
JEE5 New Features
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Ta Javaserverside Eran Toch
Ta Javaserverside Eran TochTa Javaserverside Eran Toch
Ta Javaserverside Eran Toch
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
 
Jsp
JspJsp
Jsp
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021
 
Seam Introduction
Seam IntroductionSeam Introduction
Seam Introduction
 
Spring overview
Spring overviewSpring overview
Spring overview
 
Windows Server AppFabric Caching - What it is & when you should use it?
Windows Server AppFabric Caching - What it is & when you should use it?Windows Server AppFabric Caching - What it is & when you should use it?
Windows Server AppFabric Caching - What it is & when you should use it?
 

Developing Transactional JEE Apps With Spring

  • 1. Transactional J(2)EE Applications with Spring Transactional POJO Programming Guy Pardon (guy@atomikos.com)
  • 2.
  • 3. Part 1 Spring Essentials
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. Part 2 Transaction Support in Spring
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. Part 3 JTA Use Cases
  • 26. Use Case 1: From Queue to DB Avoiding message loss and duplicates requires JTA! JMS JDBC Message Queue Message Listener Order Dept. DBMS Spring Application
  • 27. Use Case 2: From Queue to Queue JMS Bridge Avoiding message loss and duplicates requires JTA! JMS JMS Source Queue Target Queue
  • 28. Use Case 3: From Web to DB and Queue Web Application Consistent Processing Requires JTA! JMS JDBC Message Queue Order Dept. DBMS HTTP
  • 29. Use Case 4: Between 2 DBs Web Application Consistent Processing Requires JTA! JDBC JDBC Order Dept. DBMS HTTP Shipping Dept. DBMS
  • 30.
  • 31.