Project

General

Profile

Sample-spring-hibernate » History » Version 2

Henning Blohm, 18.09.2012 10:10

1 1 Henning Blohm
h1. A sample using Hibernate and Spring on Z2
2
3 2 Henning Blohm
This sample is very similar to [[Sample-hibernate-basic]] but differs in that we use the Spring framework throughout...
4
5
* for assembly within the modules and to wire services between modules
6
* for declarative transaction demarcation
7
* for JPA entity manager injection 
8
9
This sample is stored in "z2-samples.spring-hibernate":http://redmine.z2-environment.net/projects/z2-samples/repository/z2-samples-spring-hibernate.
10
11
h2. Prerequisites
12
13
You need the *z_tx_tests* database on a local MySQL database system. Start the MySQL client as the root user and run:
14
15
<pre><code class="SQL">
16
create database z_tx_tests;
17
grant all on z_tx_tests.* to tx@localhost identified by 'tx';
18
</code></pre>
19
20
h2. Run it
21
22
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:
23
24
<pre><code class="ruby">
25
mkdir install
26
cd install 
27
git clone -b master http://git.z2-environment.net/z2-base.core
28
git clone -b master http://git.z2-environment.net/z2-samples.spring-hibernate
29
30
# on Linux / Mac OS:
31
cd z2-base.core/run/bin
32
./gui.sh
33
34
# on Windows:
35
cd z2-base.core\run\bin
36
gui.bat
37
</code></pre>
38
39
When running, go to http://localhost:8080/spring-hibernate. You should see this:
40
41
!spring-hibernate.png!