Project

General

Profile

Sample-spring-hibernate » History » Revision 2

Revision 1 (Henning Blohm, 12.09.2012 11:45) → Revision 2/20 (Henning Blohm, 18.09.2012 10:10)

h1. A sample using Hibernate and Spring on Z2 

 This sample is very similar to [[Sample-hibernate-basic]] but differs in that we use the Spring framework throughout... 

 * for assembly within the modules and to wire services between modules 
 * for declarative transaction demarcation 
 * for JPA entity manager injection  

 This sample is stored in "z2-samples.spring-hibernate":http://redmine.z2-environment.net/projects/z2-samples/repository/z2-samples-spring-hibernate. 

 h2. Prerequisites 

 You need the *z_tx_tests* database on a local MySQL database system. Start the MySQL client as the root user and run: 

 <pre><code class="SQL"> 
 create database z_tx_tests; 
 grant all on z_tx_tests.* to tx@localhost identified by 'tx'; 
 </code></pre> 

 h2. Run it 

 Like all samples, also this sample can be run as in [[How to run a sample]]. If you have the database, the fastest way to verify whether it runs is: 

 <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.spring-hibernate 

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

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

 When running, go to http://localhost:8080/spring-hibernate. You should see this: 

 !spring-hibernate.png! 

 tbc