Project

General

Profile

Sample-jta-spring » History » Revision 4

Revision 3 (Henning Blohm, 27.09.2012 22:13) → Revision 4/16 (Henning Blohm, 27.09.2012 22:19)

h1. Using a Spring configured full-blown transaction manager across modules in Z2 

 As does [[Samples-jta-plain]], so does this sample demonstrate how to use Z2 with the Atomikos transaction manager. In this case however, we choose to use the Spring framework to configure the transaction manager and enable re-use using Z2's support for modular Spring applications (see also [[How to Spring]]). 

 The Wiki page [[How_to_TransactionManager]] explains the general principles behind transaction handling in Z2. 

 This sample is stored in "z2-samples.jta-spring":http://redmine.z2-environment.net/projects/z2-samples/repository/z2-samples-jta-spring. It implements exactly the same scenario as [[Sample-spring-hibernate]] with the exception of not using the built-in JTA implementation. 

 h2. Prerequisites 

 You need to run Java DB as network server on localhost. This is explained next. 

 The application will create a database "z2-samples" 

 {{include(How to run Java db)}} 

 h2. Running the sample 

 This sample is run as explained in [[How to run a sample]]. The 5 minutes version: 

 <pre><code class="ruby"> 
 mkdir install 
 cd install  
 git clone -b master http://git.z2-environment.net/z2-base.core 
 git clone -b master http://git.z2-environment.net/z2-samples.jta-spring 

 # on Linux / Mac OS: 
 cd z2-base.core/run/bin 
 ./gui.sh 

 # on Windows: 
 cd z2-base.core\run\bin 
 gui.bat 
 </code></pre> 

 h2. Verifying 

 When everything is up, go to http://localhost:8080/jta-spring. http://localhost:8080/jta.spring. You see something like this:  



 And indeed, it's the same database we use elsewhere. 

 h2. Now to the point... 

 So, here are the details and why this sample is interesting.  

 Until that part has been written (sorry) - please checkout the sample. If you are familiar with Spring and have a slight idea about JTA, you should see the beauty of it.