cloudstore-memoizeit

Showcase v2

8/21/2014 4:02:03 AM

Changes

application/deploy-amazon.sh 56(+0 -56)

application/erm.mwb 0(+0 -0)

application/pom.xml 231(+84 -147)

application/README.md 68(+57 -11)

application/src/main/java/eu/cloudscale/showcase/test/JDBCtest.java 34(+0 -34)

application/src/main/resources/app.properties 3(+0 -3)

application/src/main/resources/database/database.aws.hibernate.properties 6(+0 -6)

application/src/main/resources/database/database.aws.mongodb.properties 6(+0 -6)

application/src/main/resources/generate/database.aws.hibernate.properties 6(+0 -6)

application/src/main/webapp/resources/img/logo-CloudScale-aws.png 0(+0 -0)

application/src/main/webapp/WEB-INF/views/templates/layout.html 80(+0 -80)

Details

diff --git a/application/.project b/application/.project
index 6f84204..bb244aa 100644
--- a/application/.project
+++ b/application/.project
@@ -37,6 +37,7 @@
 		</buildCommand>
 	</buildSpec>
 	<natures>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
 		<nature>org.springframework.ide.eclipse.core.springnature</nature>
 		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.eclipse.m2e.core.maven2Nature</nature>

application/pom.xml 231(+84 -147)

diff --git a/application/pom.xml b/application/pom.xml
index 11aebad..021fc7b 100644
--- a/application/pom.xml
+++ b/application/pom.xml
@@ -3,8 +3,8 @@
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>eu.cloudscale</groupId>
-	<artifactId>showcase</artifactId>
-	<name>40-Spring_webshop</name>
+	<artifactId>showcaseV2</artifactId>
+	<name>showcaseV2</name>
 	<packaging>war</packaging>
 	<version>1.0.0-BUILD-SNAPSHOT</version>
 	<repositories>
@@ -23,29 +23,21 @@
 
 		<!-- Logging -->
 		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>jcl-over-slf4j</artifactId>
-			<version>1.7.5</version>
-			<scope>runtime</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-api</artifactId>
-			<version>1.7.5</version>
-			<scope>runtime</scope>
+			<groupId>commons-logging</groupId>
+			<artifactId>commons-logging</artifactId>
+			<version>1.1.1</version>
 		</dependency>
+
 		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-log4j12</artifactId>
-			<version>1.7.5</version>
-			<scope>runtime</scope>
+			<groupId>org.apache.logging.log4j</groupId>
+			<artifactId>log4j-api</artifactId>
+			<version>2.0.1</version>
 		</dependency>
 		<dependency>
-			<groupId>log4j</groupId>
-			<artifactId>log4j</artifactId>
-			<version>${log4j.version}</version>
+			<groupId>org.apache.logging.log4j</groupId>
+			<artifactId>log4j-core</artifactId>
+			<version>2.0.1</version>
 		</dependency>
-
 		<!-- <dependency> -->
 		<!-- <groupId>javax.inject</groupId> -->
 		<!-- <artifactId>javax.inject</artifactId> -->
@@ -168,13 +160,38 @@
 			<artifactId>spring-jdbc</artifactId>
 			<version>${org.springframework.version}</version>
 		</dependency>
-		<dependency>
-			<groupId>nz.net.ultraq.thymeleaf</groupId>
-			<artifactId>thymeleaf-layout-dialect</artifactId>
-			<version>1.1.3</version>
-		</dependency>
 	</dependencies>
 	<build>
+		<pluginManagement>
+			<plugins>
+				<!-- Ignore/Execute plugin execution -->
+				<plugin>
+					<groupId>org.eclipse.m2e</groupId>
+					<artifactId>lifecycle-mapping</artifactId>
+					<version>1.0.0</version>
+					<configuration>
+						<lifecycleMappingMetadata>
+							<pluginExecutions>
+								<!-- copy-dependency plugin -->
+								<pluginExecution>
+									<pluginExecutionFilter>
+										<groupId>org.apache.maven.plugins</groupId>
+										<artifactId>maven-dependency-plugin</artifactId>
+										<versionRange>[1.0.0,)</versionRange>
+										<goals>
+											<goal>copy-dependencies</goal>
+										</goals>
+									</pluginExecutionFilter>
+									<action>
+										<ignore />
+									</action>
+								</pluginExecution>
+							</pluginExecutions>
+						</lifecycleMappingMetadata>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
 		<plugins>
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
@@ -223,15 +240,30 @@
 			<!-- </plugin> -->
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<version>2.8</version>
+				<executions>
+					<execution>
+						<id>copy-dependencies</id>
+						<phase>package</phase>
+						<goals>
+							<goal>copy-dependencies</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory>
+							<overWriteReleases>true</overWriteReleases>
+							<overWriteSnapshots>true</overWriteSnapshots>
+							<overWriteIfNewer>true</overWriteIfNewer>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-war-plugin</artifactId>
 				<version>2.4</version>
 				<!-- Enable filtering in web.xml -->
 				<configuration>
-					<archive>
-						<manifest>
-							<addClasspath>true</addClasspath>
-						</manifest>
-					</archive>
 					<webResources>
 						<resource>
 							<filtering>true</filtering>
@@ -259,147 +291,52 @@
 			<!-- <downloadJavadocs>true</downloadJavadocs> -->
 			<!-- </configuration> -->
 			<!-- </plugin> -->
-			<!-- <plugin> -->
-			<!-- <groupId>org.apache.maven.plugins</groupId> -->
-			<!-- <artifactId>maven-compiler-plugin</artifactId> -->
-			<!-- <version>2.5.1</version> -->
-			<!-- <configuration> -->
-			<!-- <source>1.6</source> -->
-			<!-- <target>1.6</target> -->
-			<!-- <compilerArgument>-Xlint:all</compilerArgument> -->
-			<!-- <showWarnings>true</showWarnings> -->
-			<!-- <showDeprecation>true</showDeprecation> -->
-			<!-- </configuration> -->
-			<!-- </plugin> -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.5.1</version>
+				<configuration>
+					<source>1.6</source>
+					<target>1.6</target>
+					<!-- <compilerArgument>-Xlint:all</compilerArgument> -->
+					<!-- <showWarnings>true</showWarnings> -->
+					<!-- <showDeprecation>true</showDeprecation> -->
+				</configuration>
+			</plugin>
 			<!-- <plugin> -->
 			<!-- <groupId>org.codehaus.mojo</groupId> -->
 			<!-- <artifactId>exec-maven-plugin</artifactId> -->
+			<!-- <version>1.2.1</version> -->
 			<!-- <configuration> -->
 			<!-- <mainClass>org.test.int1.Main</mainClass> -->
 			<!-- </configuration> -->
 			<!-- </plugin> -->
-			<!-- <plugin> -->
-			<!-- <artifactId>maven-assembly-plugin</artifactId> -->
-			<!-- <configuration> -->
-			<!-- <archive> -->
-			<!-- <manifest> -->
-			<!-- <mainClass>eu.cloudscaleproject.showcase.db.generate.Generate</mainClass> -->
-			<!-- </manifest> -->
-			<!-- </archive> -->
-			<!-- <descriptorRefs> -->
-			<!-- <descriptorRef>jar-with-dependencies</descriptorRef> -->
-			<!-- </descriptorRefs> -->
-			<!-- </configuration> -->
-			<!-- <executions> -->
-			<!-- <execution> -->
-			<!-- <id>make-assembly</id> -->
-			<!-- <phase>package</phase> -->
-			<!-- <goals> -->
-			<!-- <goal>single</goal> -->
-			<!-- </goals> -->
-			<!-- </execution> -->
-			<!-- </executions> -->
-			<!-- </plugin> -->
-
-			<plugin>
-				<groupId>org.codehaus.mojo</groupId>
-				<artifactId>exec-maven-plugin</artifactId>
-				<version>1.2.1</version>
-				<configuration>
-					<executable>java</executable>
-					<arguments>
-						<argument>-Djava.library.path=${project.build.directory}/lib</argument>
-						<argument>-classpath ${compile.classpath}</argument>
-						<argument>eu.cloudscale.showcase.generate.Generate</argument>
-						<argument>${dbtype}</argument>
-					</arguments>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-dependency-plugin</artifactId>
-				<version>2.8</version>
-				<executions>
-					<execution>
-						<id>copy-dependencies</id>
-						<phase>package</phase>
-						<goals>
-							<goal>copy-dependencies</goal>
-						</goals>
-						<configuration>
-							<overWriteReleases>false</overWriteReleases>
-							<overWriteSnapshots>false</overWriteSnapshots>
-							<overWriteIfNewer>true</overWriteIfNewer>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
 		</plugins>
 		<resources>
 			<resource>
 				<directory>src/main/resources</directory>
 				<filtering>true</filtering>
-				<excludes>
-					<exclude>jmeter</exclude>
-					<exclude>matlab</exclude>
-					<exclude>rbe</exclude>
-					<exclude>results</exclude>
-					<exclude>aws</exclude>
-				</excludes>
 			</resource>
 		</resources>
-		<pluginManagement>
-			<plugins>
-				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
-				<plugin>
-					<groupId>org.eclipse.m2e</groupId>
-					<artifactId>lifecycle-mapping</artifactId>
-					<version>1.0.0</version>
-					<configuration>
-						<lifecycleMappingMetadata>
-							<pluginExecutions>
-								<pluginExecution>
-									<pluginExecutionFilter>
-										<groupId>
-											org.apache.maven.plugins
-										</groupId>
-										<artifactId>
-											maven-dependency-plugin
-										</artifactId>
-										<versionRange>
-											[2.8,)
-										</versionRange>
-										<goals>
-											<goal>
-												copy-dependencies
-											</goal>
-										</goals>
-									</pluginExecutionFilter>
-									<action>
-										<ignore></ignore>
-									</action>
-								</pluginExecution>
-							</pluginExecutions>
-						</lifecycleMappingMetadata>
-					</configuration>
-				</plugin>
-			</plugins>
-		</pluginManagement>
 	</build>
 	<profiles>
 		<profile>
-			<id>amazon-hibernate</id>
+			<id>hibernate</id>
+			<activation>
+				<activeByDefault>true</activeByDefault>
+			</activation>
 			<properties>
-				<eu.cloudscale.environment>aws</eu.cloudscale.environment>
 				<eu.cloudscale.datasource>hibernate</eu.cloudscale.datasource>
-				<eu.cloudscale.showcase.generate.properties>classpath:database/database.aws.hibernate.properties</eu.cloudscale.showcase.generate.properties>
+				<enable.opensessioninviewfilter.start>&lt;!--</enable.opensessioninviewfilter.start>
+				<enable.opensessioninviewfilter.end>--&gt;</enable.opensessioninviewfilter.end>
 			</properties>
 		</profile>
 		<profile>
-			<id>amazon-mongodb</id>
+			<id>mongodb</id>
 			<properties>
-				<eu.cloudscale.environment>aws</eu.cloudscale.environment>
 				<eu.cloudscale.datasource>mongodb</eu.cloudscale.datasource>
+				<enable.opensessioninviewfilter.start></enable.opensessioninviewfilter.start>
+				<enable.opensessioninviewfilter.end></enable.opensessioninviewfilter.end>
 			</properties>
 		</profile>
 	</profiles>

application/README.md 68(+57 -11)

diff --git a/application/README.md b/application/README.md
index 9eb7479..a0f48c9 100644
--- a/application/README.md
+++ b/application/README.md
@@ -1,21 +1,67 @@
-<<<<<<< HEAD
-##Introduction
-Here you will find a modernized version of TPC-W e-commerce benchmark applicatin. Basically the application is a very simple bookshop. The modernized version is written in SpringFramework and uses Maven for building.
+### Introduction
 
-##Building
-Before building a `war` package choose which database you want to use. Showcase support two databases, MySQL and MongoDB. Configuration files for each one are in `src/main/resources/database/`.
+In this directory you will find the source code for showcase for CloudScale project. The showcase is a webapplication of reimplemented book shop according to TPC-W specifications and it's written in Spring framework.
+
+This is Eclipse project so we recommend to import this project into Eclipse and contuine from there.
+
+### Running from Eclipse
+
+Import project into Eclipse. Before running showcase, you will need to setup Apache Tomcat server in Eclipse. Don't forget to add Maven Dependencies to the Deployment Assembly setting for this project.
+
+To run showcase on Tomcat server, right click on project and choose Run As -> Run on server. 
+
+### Building
+
+Before building a war package choose which database you want to use. Showcase support two databases, MySQL and MongoDB. Configuration files for each one of them are in `src/main/resources/database/`.
 
 To build showcase for MySQL or MongoDB use Maven profiles:
 
-```bash 
-$ mvn -Pamazon-hibernate install
+```bash
+$ mvn -Phibernate -Dconnection_pool_size=<number> install 
 ```
 
 or
 
 ```bash
-$ mvn -Pamazon-mongodb install
+$ mvn -Pmongodb -Dconnection_pool_size=<number> install
+```
+
+Notice the `-Dconnection_pool_size=<number>` compile parameter. Here you set the maximum size of connection pool for database.
+
+After building you get `.war` file in `target/` directory. You can upload this file on Tomcat or any other Java web container that is able to run `.war` files.
+
+### Generating images
+
+You can generate images by configuring and executing the file `generate_images.sh` with Perl:
+
+```bash
+$ perl generate_images.sh
 ```
-=======
-Showcase
->>>>>>> 60bb954... Initial commit
+
+**NOTICE** You need to add the execute permission to `ImgGen/ImgFiles/tpcwIMG`!
+
+This script will generate images in `main/webapp/resources/img/` directory. 
+
+Important configuration properties in `generate_images.sh` are:
+
+ 1. `$NUM_ITEMS` - refers to the number of rows in `items` database table
+ 2. `$DEST_DIR` - directory where to save images
+ 3. `$GEN_DIR` - the location of generator script 
+ 
+### Generating database
+
+To generate database you need to edit `src/main/resources/app-context.xml` file and replace row:
+
+```
+<import resource="${eu.cloudscale.environment}" />
+```
+
+with
+
+```
+<import resource="hibernate.xml" /> or <import resource="mongodb.xml" />
+```
+
+You'll also need to edit a configuration for choosen database `hibernate.xml` or `mongodb.xml` and set the actual number instead of variable placeholder `${connection_pool_size}`.
+
+Then you can run `src/main/java/eu/cloudscale/showcase/generate/Generate.java` from Eclipse
\ No newline at end of file
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/AService.java b/application/src/main/java/eu/cloudscale/showcase/db/AService.java
index 8be2422..525bf86 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/AService.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/AService.java
@@ -7,6 +7,8 @@ import java.util.List;
 import java.util.Random;
 import java.util.Set;
 
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -30,11 +32,11 @@ import eu.cloudscale.showcase.db.model.IOrders;
 import eu.cloudscale.showcase.db.model.IShoppingCart;
 import eu.cloudscale.showcase.db.model.IShoppingCartLine;
 
-@Transactional(readOnly=true)
 public abstract class AService implements IService
 {	
 	@SuppressWarnings( "rawtypes" )
 	@Override
+	@Transactional
 	@Cacheable("newProducts")
 	public List getNewProducts(String category)
 	{
@@ -42,7 +44,6 @@ public abstract class AService implements IService
 	}
 
 	@Override
-	@Transactional(readOnly=false)
 	public IShoppingCart doCart(Integer shoppingId, Integer itemId,
 	        List<Integer> ids, List<Integer> quantities)
 	{
@@ -62,8 +63,7 @@ public abstract class AService implements IService
 
 		return scDao.findById( shoppingId );
 	}
-	
-	@Transactional(readOnly=false)
+
 	protected void addRandomItemToCartIfNecessary(IShoppingCartLineDao sclDao,
 	        int SHOPPING_ID)
 	{
@@ -85,7 +85,7 @@ public abstract class AService implements IService
 			ex.printStackTrace();
 		}
 	}
-	
+
 	protected IShoppingCart getCart(Integer shoppingId, double discount)
 	{
 		IShoppingCartDao scDao = getShoppingCartDaoImpl();
@@ -93,7 +93,6 @@ public abstract class AService implements IService
 		return sc;
 	}
 
-	@Transactional(readOnly=false)
 	protected void resetCartTime(IShoppingCartLineDao sclDao, Integer shoppingId)
 	{
 		IShoppingCartDao scDao = getShoppingCartDaoImpl();
@@ -126,7 +125,6 @@ public abstract class AService implements IService
 	// return relatedItem;
 	// }
 
-	@Transactional(readOnly=false)
 	protected void refreshCart(Integer shoppingId, List<Integer> ids,
 	        List<Integer> quantities)
 	{
@@ -149,7 +147,7 @@ public abstract class AService implements IService
 
 	}
 
-	@Transactional(readOnly=false)
+	@Transactional
 	protected void addItem(Integer shoppingId, IItem item)
 	{
 		IShoppingCartLineDao sclDao = getShoppingCartLineDaoImpl();
@@ -179,7 +177,6 @@ public abstract class AService implements IService
 	}
 
 	@Override
-	@Transactional(readOnly=false)
 	public BuyConfirmResult doBuyConfirm(Integer shoppingId,
 	        Integer customerId, String ccType, long ccNumber, String ccName,
 	        Date ccExpiry, String shipping, String street1, String street2,
@@ -207,7 +204,6 @@ public abstract class AService implements IService
 	}
 
 	@Override
-	@Transactional(readOnly=false)
 	public BuyConfirmResult doBuyConfirm(Integer shoppingId,
 	        Integer customerId, String ccType, Long ccNumber, String ccName,
 	        Date ccExpiry, String shipping)
@@ -226,8 +222,7 @@ public abstract class AService implements IService
 
 		return new BuyConfirmResult( order, sc );
 	}
-	
-	@Transactional(readOnly=false)
+
 	protected void clearCart(Integer shoppingId)
 	{
 		IShoppingCartDao scDao = getShoppingCartDaoImpl();
@@ -246,7 +241,6 @@ public abstract class AService implements IService
 		}
 	}
 
-	@Transactional(readOnly=false)
 	protected ICcXacts saveCcXacts(IOrders order, String ccType, long ccNumber,
 	        String ccName, Date ccExpiry, IShoppingCart cart, IAddress address)
 	{
@@ -273,8 +267,7 @@ public abstract class AService implements IService
 
 		return ccXacts;
 	}
-	
-	@Transactional(readOnly=false)
+
 	protected IAddress saveAddress(String street1, String street2, String city,
 	        String state, String zip, String country)
 	{
@@ -294,8 +287,7 @@ public abstract class AService implements IService
 
 		return address;
 	}
-	
-	@Transactional(readOnly=false)
+
 	protected IOrders saveOrder(IAddress address, ICustomer customer,
 	        String shipping, IShoppingCart sc, double discount)
 	{
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/common/DatabaseHelper.java b/application/src/main/java/eu/cloudscale/showcase/db/common/DatabaseHelper.java
index 1221688..27af0af 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/common/DatabaseHelper.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/common/DatabaseHelper.java
@@ -1,5 +1,12 @@
 package eu.cloudscale.showcase.db.common;
 
+import java.io.IOException;
+import java.util.Properties;
+
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PropertiesLoaderUtils;
+
 import eu.cloudscale.showcase.db.IService;
 
 
@@ -13,7 +20,7 @@ public class DatabaseHelper
 	{
 		if( db == null )
 		{
-    		db = (IService) ContextHelper.getApplicationContext().getBean( "service" );
+    			db = (IService) ContextHelper.getApplicationContext().getBean( "service" );
 		}
 		
 		return db;
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/AddressDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/AddressDaoImpl.java
index 3290e16..edc43e2 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/AddressDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/AddressDaoImpl.java
@@ -12,7 +12,7 @@ import eu.cloudscale.showcase.db.model.IAddress;
 import eu.cloudscale.showcase.db.model.hibernate.Address;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class AddressDaoImpl extends DaoImpl<IAddress> implements IAddressDao
 {
 	public AddressDaoImpl()
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/AuthorDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/AuthorDaoImpl.java
index ce076ce..df5e1c9 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/AuthorDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/AuthorDaoImpl.java
@@ -13,7 +13,7 @@ import eu.cloudscale.showcase.db.model.IAuthor;
 import eu.cloudscale.showcase.db.model.hibernate.Author;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class AuthorDaoImpl extends DaoImpl<IAuthor> implements IAuthorDao
 {
 	public AuthorDaoImpl()
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CcXactsDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CcXactsDaoImpl.java
index 592d195..a8339b3 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CcXactsDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CcXactsDaoImpl.java
@@ -14,7 +14,7 @@ import eu.cloudscale.showcase.db.model.ICcXacts;
 import eu.cloudscale.showcase.db.model.hibernate.CcXacts;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class CcXactsDaoImpl extends DaoImpl<ICcXacts> implements ICcXactsDao
 {
 	
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CountryDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CountryDaoImpl.java
index f9c99e6..642f74a 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CountryDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CountryDaoImpl.java
@@ -13,10 +13,9 @@ import eu.cloudscale.showcase.db.model.ICountry;
 import eu.cloudscale.showcase.db.model.hibernate.Country;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class CountryDaoImpl extends DaoImpl<ICountry> implements ICountryDao
 {
-	private String tableName = "country";
 
 	public CountryDaoImpl()
 	{
@@ -62,11 +61,4 @@ public class CountryDaoImpl extends DaoImpl<ICountry> implements ICountryDao
 	{
 		return new Country();
 	}
-    
-    @Override
-    public void createTable()
-    {
-    	String query = "CREATE TABLE IF NOT EXISTS " + this.tableName;
-    	getCurrentSession().createSQLQuery( query );
-    }
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CustomerDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CustomerDaoImpl.java
index fe42bca..fc88097 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CustomerDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CustomerDaoImpl.java
@@ -14,7 +14,7 @@ import eu.cloudscale.showcase.db.model.ICustomer;
 import eu.cloudscale.showcase.db.model.hibernate.Customer;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class CustomerDaoImpl extends DaoImpl<ICustomer> implements ICustomerDao
 {
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/DaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/DaoImpl.java
index 1d5aca3..eed62d6 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/DaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/DaoImpl.java
@@ -1,12 +1,14 @@
 package eu.cloudscale.showcase.db.dao.hibernate.impl;
 
+import javax.naming.NamingException;
+
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.springframework.transaction.annotation.Transactional;
 
 import eu.cloudscale.showcase.db.dao.IDao;
 
-@Transactional(readOnly=true)
+@Transactional
 public class DaoImpl<T> implements IDao<T>
 {
 	protected int count = 1;
@@ -18,6 +20,15 @@ public class DaoImpl<T> implements IDao<T>
 	
 	public DaoImpl(SessionFactory sessionFactory)
 	{
+		try
+        {
+	        System.out.println("SessionFactory = " + sessionFactory.getReference());
+        }
+        catch ( NamingException e )
+        {
+	        // TODO Auto-generated catch block
+	        e.printStackTrace();
+        }
 		this.sessionFactory = sessionFactory;
 	}
 	
@@ -28,7 +39,6 @@ public class DaoImpl<T> implements IDao<T>
     }
 	
 	@Override
-	@Transactional(readOnly=false)
 	public T shrani(T object) 
 	{	
     	getCurrentSession().saveOrUpdate( object );
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ItemDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ItemDaoImpl.java
index 3dfbe77..9703535 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ItemDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ItemDaoImpl.java
@@ -3,6 +3,8 @@ package eu.cloudscale.showcase.db.dao.hibernate.impl;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.naming.NamingException;
+
 import org.hibernate.CacheMode;
 import org.hibernate.Hibernate;
 import org.hibernate.Query;
@@ -21,7 +23,7 @@ import eu.cloudscale.showcase.db.model.IItem;
 import eu.cloudscale.showcase.db.model.hibernate.Item;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class ItemDaoImpl extends DaoImpl<IItem> implements IItemDao
 {
 
@@ -35,6 +37,14 @@ public class ItemDaoImpl extends DaoImpl<IItem> implements IItemDao
 	public ItemDaoImpl(SessionFactory sessionFactory)
 	{
 		super( sessionFactory );
+		try
+        {
+	        System.out.println(sessionFactory.getReference());
+        }
+        catch ( NamingException e )
+        {
+	        e.printStackTrace();
+        }
 	}
 
 	@SuppressWarnings( "unchecked" )
@@ -124,36 +134,33 @@ public class ItemDaoImpl extends DaoImpl<IItem> implements IItemDao
 	@Transactional( readOnly = true )
 	public List<Object[]> getBestSellers(String category)
 	{
-		Session session = sessionFactory.openSession();
-
-		 Query query =
-		 session.createQuery("SELECT I.IId, A.AFname, A.ALname, I.ITitle, SUM(OL.olQty) AS val " +
-		 		"FROM OrderLine as OL, Item as I, Author as A " +
-		 		"WHERE " +
-		 		"I.author.AId = A.AId AND " +
-		 		"I.IId = OL.item.IId AND " +
-		 		"I.ISubject = :category " +
-		 		"GROUP BY OL.item.IId " +
-		 		"ORDER BY val DESC");
-
-//		Query query = session
-//		        .createSQLQuery(
-//		                "SELECT i_id as a, i_title as b, a_fname as c, a_lname as d, SUM(ol_qty) AS val "
-//		                        + "FROM "
-//		                        + "orders, order_line, item, author "
-//		                        + "WHERE "
-//		                        + "order_line.ol_o_id = orders.o_id AND item.i_id = order_line.ol_i_id "
-//		                        + "AND item.i_subject = :category AND item.i_a_id = author.a_id GROUP BY i_id "
-//		                        + "ORDER BY orders.o_date, val DESC" )
-//		        .addScalar( "a" ).addScalar( "b" ).addScalar( "c" )
-//		        .addScalar( "d" ).addScalar( "val" );
+		Session session = sessionFactory.getCurrentSession();
+
+		// Query query =
+		// session.createQuery("SELECT I, A, SUM(OL.olQty) AS val "
+		// + " FROM OrderLine as OL, Item as I, Author as A"
+		// +
+		// " WHERE OL.item.IId = I.IId AND I.ISubject = :category AND I.author.AId = A.AId"
+		// + " GROUP BY I.IId ORDER BY val DESC");
+
+		Query query = session
+		        .createSQLQuery(
+		                "SELECT i_id as a, i_title as b, a_fname as c, a_lname as d, SUM(ol_qty) AS val "
+		                        + "FROM "
+		                        + "orders, order_line, item, author "
+		                        + "WHERE "
+		                        + "order_line.ol_o_id = orders.o_id AND item.i_id = order_line.ol_i_id "
+		                        + "AND item.i_subject = :category AND item.i_a_id = author.a_id GROUP BY i_id "
+		                        + "ORDER BY orders.o_date, val DESC" )
+		        .addScalar( "a" ).addScalar( "b" ).addScalar( "c" )
+		        .addScalar( "d" ).addScalar( "val" );
 
 		query.setParameter( "category", category );
 		query.setMaxResults( 50 );
 
 		long start = System.nanoTime();
 		List<Object[]> res = query.list();
-		System.out.println( "[best-sellers] Category = " + category + ", cas izvajanja = "
+		System.out.println( "Drek na palci se je izvajal: "
 		        + ( System.nanoTime() - start ) / 1E9 );
 
 		return res;
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/OrderLineDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/OrderLineDaoImpl.java
index 365978b..ab7a706 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/OrderLineDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/OrderLineDaoImpl.java
@@ -14,7 +14,7 @@ import eu.cloudscale.showcase.db.model.IOrders;
 import eu.cloudscale.showcase.db.model.hibernate.OrderLine;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class OrderLineDaoImpl extends DaoImpl<IOrderLine> implements IOrderLineDao
 {
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/OrdersDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/OrdersDaoImpl.java
index d36bd24..88c4154 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/OrdersDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/OrdersDaoImpl.java
@@ -14,7 +14,7 @@ import eu.cloudscale.showcase.db.model.IOrders;
 import eu.cloudscale.showcase.db.model.hibernate.Orders;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class OrdersDaoImpl extends DaoImpl<IOrders> implements IOrdersDao
 {
 	public OrdersDaoImpl()
@@ -39,7 +39,7 @@ public class OrdersDaoImpl extends DaoImpl<IOrders> implements IOrdersDao
     public IOrders getMostRecentOrder(ICustomer customer)
     {
 
-		String hql16 = "SELECT O FROM Orders as O, Customer as C WHERE O.customer.CId = C.CId AND C.CUname = :cid ORDER BY O.ODate, O.OId DESC";
+		String hql16 = "SELECT O FROM Orders as O, Customer as C WHERE O.customer.CId = C.CId AND C.CId = :cid ORDER BY O.ODate, O.OId DESC";
 		Query query16 = getCurrentSession().createQuery( hql16 );
 		query16.setMaxResults( 1 );
 		query16.setParameter( "cid", customer.getCId() );
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartDaoImpl.java
index e67e099..f309282 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartDaoImpl.java
@@ -17,7 +17,7 @@ import eu.cloudscale.showcase.db.model.IShoppingCartLine;
 import eu.cloudscale.showcase.db.model.hibernate.ShoppingCart;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class ShoppingCartDaoImpl extends DaoImpl<IShoppingCart> implements IShoppingCartDao
 {
 
@@ -33,9 +33,9 @@ public class ShoppingCartDaoImpl extends DaoImpl<IShoppingCart> implements IShop
 	}
 
     @Override
-    @Transactional(readOnly=false)
     public Integer createEmptyCart()
     {
+    	
 		IShoppingCart sc = new ShoppingCart();
 		sc.setScTime( new Date() );
 		shrani( sc );
@@ -45,6 +45,7 @@ public class ShoppingCartDaoImpl extends DaoImpl<IShoppingCart> implements IShop
 
     @SuppressWarnings( "rawtypes" )
     @Override
+    @Transactional
     public IShoppingCart findById(Integer shoppingId)
     {
     	Session session = getCurrentSession();
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartLineDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartLineDaoImpl.java
index eea318c..d3dd3a0 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartLineDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartLineDaoImpl.java
@@ -14,7 +14,7 @@ import eu.cloudscale.showcase.db.model.IShoppingCartLine;
 import eu.cloudscale.showcase.db.model.hibernate.ShoppingCartLine;
 
 @Repository
-@Transactional(readOnly=true)
+@Transactional
 public class ShoppingCartLineDaoImpl extends DaoImpl<IShoppingCartLine> implements IShoppingCartLineDao
 {
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/ICountryDao.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/ICountryDao.java
index b3cb8f2..aa2e1ce 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/ICountryDao.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/ICountryDao.java
@@ -8,7 +8,5 @@ public interface ICountryDao extends IDao<ICountry>
 	public ICountry findById(int id);
 
 	public ICountry getByName(String country);
-	
-	public void createTable();
 
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/CountryDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/CountryDaoImpl.java
index ab53e53..9db3501 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/CountryDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/CountryDaoImpl.java
@@ -60,9 +60,4 @@ public class CountryDaoImpl extends DaoImpl<ICountry> implements ICountryDao
 		
 		return super.shrani( object );
 	}
-
-	@Override
-    public void createTable()
-    {
-    }
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/DaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/DaoImpl.java
index 3f75394..559940b 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/DaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/DaoImpl.java
@@ -2,7 +2,6 @@ package eu.cloudscale.showcase.db.dao.mongo.impl;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.MongoTemplate;
-import org.springframework.transaction.annotation.Transactional;
 
 public abstract class DaoImpl<T> implements IDaoExt<T>
 {
@@ -19,7 +18,6 @@ public abstract class DaoImpl<T> implements IDaoExt<T>
 	}
 	
 	@Override
-	@Transactional(readOnly=false)
 	public T shrani(T object) 
 	{	
 		mongoOps.save( object );
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/ShoppingCartDaoImpl.java b/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/ShoppingCartDaoImpl.java
index b0f59e5..aacad2d 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/ShoppingCartDaoImpl.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/ShoppingCartDaoImpl.java
@@ -27,6 +27,7 @@ public class ShoppingCartDaoImpl extends DaoImpl<IShoppingCart> implements IShop
 	@Override
     public Integer createEmptyCart()
     {
+		
 		IShoppingCart sc = new ShoppingCart();
 		sc.setScId( getLastId() + 1 );
 		sc.setScTime( new Date() );
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/IService.java b/application/src/main/java/eu/cloudscale/showcase/db/IService.java
index ecdecc1..562b2d8 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/IService.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/IService.java
@@ -10,6 +10,7 @@ import eu.cloudscale.showcase.db.model.IShoppingCart;
 public interface IService extends IDaos
 {
 	
+	@SuppressWarnings( "rawtypes" )
     public List getNewProducts(String category);
 
 	public IShoppingCart doCart(Integer shoppingId, Integer itemId,
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/model/hibernate/CcXacts.java b/application/src/main/java/eu/cloudscale/showcase/db/model/hibernate/CcXacts.java
index 35c0adb..9263bc7 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/model/hibernate/CcXacts.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/model/hibernate/CcXacts.java
@@ -43,7 +43,7 @@ public class CcXacts implements ICcXacts
 
 	private Date     cxExpiry;
 
-	private IAuthor  cxAuthId;
+	private String  cxAuthId;
 
 	private Double   cxXactAmt;
 
@@ -130,17 +130,17 @@ public class CcXacts implements ICcXacts
 		this.cxExpiry = cxExpiry;
 	}
 
-//	@Column( name = "CX_AUTH_ID", length = 15 )
-	@OneToOne( targetEntity=Author.class, fetch=FetchType.EAGER)
-	@JoinColumn( name="CX_AUTH_ID" )
+	@Column( name = "CX_AUTH_ID", length = 15 )
+//	@OneToOne( targetEntity=Author.class, fetch=FetchType.EAGER)
+//	@JoinColumn( name="CX_AUTH_ID" )
 	@Override
-	public IAuthor getCxAuthId()
+	public String getCxAuthId()
 	{
 		return this.cxAuthId;
 	}
 
 	@Override
-	public void setCxAuthId(IAuthor cxAuthId)
+	public void setCxAuthId(String cxAuthId)
 	{
 		this.cxAuthId = cxAuthId;
 	}
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/model/hibernate/Item.java b/application/src/main/java/eu/cloudscale/showcase/db/model/hibernate/Item.java
index ceed572..d7fb2c1 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/model/hibernate/Item.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/model/hibernate/Item.java
@@ -39,7 +39,7 @@ public class Item implements java.io.Serializable, IItem
 
 	private static final long serialVersionUID  = 8806932749710043085L;
 
-	private Integer           IId;
+	private Integer            id;
 
 	private IAuthor           author;
 
@@ -98,12 +98,12 @@ public class Item implements java.io.Serializable, IItem
 	@Column( name = "I_ID", unique = true, nullable = false )
 	public Integer getIId()
 	{
-		return this.IId;
+		return this.id;
 	}
 
 	public void setIId(Integer IId)
 	{
-		this.IId = IId;
+		this.id = IId;
 	}
 
 	@ManyToOne( targetEntity=Author.class, fetch = FetchType.LAZY )
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java b/application/src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java
index d7e3add..c695622 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java
@@ -33,9 +33,9 @@ public interface ICcXacts
 
 	public void setCxExpiry(Date cxExpiry);
 
-	public IAuthor getCxAuthId();
+	public String getCxAuthId();
 
-	public void setCxAuthId(IAuthor cxAuthId);
+	public void setCxAuthId(String cxAuthId);
 
 	public Double getCxXactAmt();
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/model/mongo/CcXacts.java b/application/src/main/java/eu/cloudscale/showcase/db/model/mongo/CcXacts.java
index 419a988..d323be1 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/model/mongo/CcXacts.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/model/mongo/CcXacts.java
@@ -46,7 +46,7 @@ public class CcXacts implements ICcXacts, Serializable
 
 	private Date     cxExpiry;
 
-	private Integer cxAuthId;
+	private String cxAuthId;
 
 	private Double   cxXactAmt;
 
@@ -140,15 +140,15 @@ public class CcXacts implements ICcXacts, Serializable
 	}
 
 	@Override
-	public IAuthor getCxAuthId()
+	public String getCxAuthId()
 	{
-		return DatabaseHelper.getDatabase().getAuthorDaoImpl().findById( this.cxAuthId );
+		return this.cxAuthId;
 	}
 
 	@Override
-	public void setCxAuthId(IAuthor cxAuthId)
+	public void setCxAuthId(String cxAuthId)
 	{
-		this.cxAuthId = cxAuthId.getAId();
+		this.cxAuthId = cxAuthId;
 	}
 
 	@Override
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/model/mongo/Orders.java b/application/src/main/java/eu/cloudscale/showcase/db/model/mongo/Orders.java
index 0ecd8ed..d81d8b1 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/model/mongo/Orders.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/model/mongo/Orders.java
@@ -1,6 +1,7 @@
 package eu.cloudscale.showcase.db.model.mongo;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
@@ -16,6 +17,7 @@ import org.springframework.stereotype.Component;
 import eu.cloudscale.showcase.db.IService;
 import eu.cloudscale.showcase.db.common.DatabaseHelper;
 import eu.cloudscale.showcase.db.model.IAddress;
+import eu.cloudscale.showcase.db.model.ICcXacts;
 import eu.cloudscale.showcase.db.model.ICustomer;
 import eu.cloudscale.showcase.db.model.IOrderLine;
 import eu.cloudscale.showcase.db.model.IOrders;
@@ -56,6 +58,10 @@ public class Orders implements IOrders, Serializable
 
 	private String         OStatus;
 	
+	private List<Integer> ccXactIds;
+
+	private List<Integer> orderLinesIds;
+	
 	public Orders()
 	{
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/db/services/HibernateService.java b/application/src/main/java/eu/cloudscale/showcase/db/services/HibernateService.java
index e2b17ed..00e5df7 100644
--- a/application/src/main/java/eu/cloudscale/showcase/db/services/HibernateService.java
+++ b/application/src/main/java/eu/cloudscale/showcase/db/services/HibernateService.java
@@ -5,6 +5,7 @@ import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import eu.cloudscale.showcase.db.AService;
 import eu.cloudscale.showcase.db.dao.IAddressDao;
@@ -21,7 +22,7 @@ import eu.cloudscale.showcase.db.model.IItem;
 
 @SuppressWarnings( "unchecked" )
 @Service
-//@Transactional(readOnly=true)
+@Transactional
 public class HibernateService extends AService
 {
 	@Autowired
diff --git a/application/src/main/java/eu/cloudscale/showcase/generate/AGenerate.java b/application/src/main/java/eu/cloudscale/showcase/generate/AGenerate.java
index 4802499..9894351 100644
--- a/application/src/main/java/eu/cloudscale/showcase/generate/AGenerate.java
+++ b/application/src/main/java/eu/cloudscale/showcase/generate/AGenerate.java
@@ -4,8 +4,8 @@ import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.Random;
 
+import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.GenericXmlApplicationContext;
-import org.springframework.transaction.annotation.Transactional;
 
 import eu.cloudscale.showcase.db.IService;
 import eu.cloudscale.showcase.db.common.ContextHelper;
@@ -22,350 +22,322 @@ import eu.cloudscale.showcase.db.model.ICustomer;
 import eu.cloudscale.showcase.db.model.IItem;
 import eu.cloudscale.showcase.db.services.MongoService;
 
-
-public abstract class AGenerate implements IGenerate
-{
+public abstract class AGenerate implements IGenerate {
 
 	// TODO: Move this to properties file
-	protected static final int    NUM_EBS       = 100;
-	
+	protected static final int NUM_EBS = 100;
+
 	// TODO: Move this to properties file
-	protected static final int    NUM_ITEMS     = 10000;
-	
+	protected static final int NUM_ITEMS = 10000;
+
 	// TODO: Move this to properties file
-	protected static final int    NUM_CUSTOMERS = NUM_EBS * 2880;
-	
+	protected static final int NUM_CUSTOMERS = NUM_EBS * 2880;
+
 	// TODO: Move this to properties file
-	protected static final int    NUM_ADDRESSES = 2 * NUM_CUSTOMERS;
-	
+	protected static final int NUM_ADDRESSES = 2 * NUM_CUSTOMERS;
+
 	// TODO: Move this to properties file
-	protected static final int    NUM_AUTHORS   = (int) ( .25 * NUM_ITEMS );
-	
+	protected static final int NUM_AUTHORS = (int) (.25 * NUM_ITEMS);
+
 	// TODO: Move this to properties file
-	protected static final int    NUM_ORDERS    = (int) ( .9 * NUM_CUSTOMERS );
+	protected static final int NUM_ORDERS = (int) (.9 * NUM_CUSTOMERS);
 
 	// TODO: Move this to properties file
-	protected static String[][]   tables        = {
-	        {"address", "addr_co_id", "addr_zip" }, {"author", "a_lname" },
-	        {"cc_xacts" }, {"country", "co_name" },
-	        {"customer", "c_addr_id", "c_uname" },
-	        {"item", "i_title", "i_subject", "i_a_id" },
-	        {"order_line", "ol_i_id", "ol_o_id" }, {"orders", "o_c_id" },
-	        {"shopping_cart" }, {"shopping_cart_line", "scl_i_id" } };
-
-	protected Random       rand          = new Random();
-	
-	protected GenericXmlApplicationContext ctx = null;
-	
-	protected IService db = null;
-	
-	public AGenerate()
-	{
-		ctx = ContextHelper.getApplicationContext();
-		db = DatabaseHelper.getDatabase();
-	}
-	
-	
-	protected String getRandomAString(int min, int max)
-	{
+	protected static String[][] tables = {
+			{ "address", "addr_co_id", "addr_zip" }, { "author", "a_lname" },
+			{ "cc_xacts" }, { "country", "co_name" },
+			{ "customer", "c_addr_id", "c_uname" },
+			{ "item", "i_title", "i_subject", "i_a_id" },
+			{ "order_line", "ol_i_id", "ol_o_id" }, { "orders", "o_c_id" },
+			{ "shopping_cart" }, { "shopping_cart_line", "scl_i_id" } };
+
+	protected Random rand = new Random();
+
+	protected ApplicationContext ctx = null;
+
+	protected IService service = null;
+
+	// public AGenerate()
+	// {
+	// ctx = ContextHelper.getApplicationContext();
+	// db = DatabaseHelper.getDatabase();
+	// }
+
+	protected String getRandomAString(int min, int max) {
 		String newstring = new String();
 		int i;
-		final char[] chars = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
-		        'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
-		        'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
-		        'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
-		        'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', '#', '$', '%', '^',
-		        '&', '*', '(', ')', '_', '-', '=', '+', '{', '}', '[', ']',
-		        '|', ':', ';', ',', '.', '?', '/', '~', ' ' }; // 79 characters
-		int strlen = (int) Math
-		        .floor( rand.nextDouble() * ( ( max - min ) + 1 ) );
+		final char[] chars = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
+				'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
+				'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+				'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
+				'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', '#', '$', '%',
+				'^', '&', '*', '(', ')', '_', '-', '=', '+', '{', '}', '[',
+				']', '|', ':', ';', ',', '.', '?', '/', '~', ' ' }; // 79
+																	// characters
+		int strlen = (int) Math.floor(rand.nextDouble() * ((max - min) + 1));
 		strlen += min;
-		for ( i = 0; i < strlen; i++ )
-		{
-			char c = chars[(int) Math.floor( rand.nextDouble() * 79 )];
-			newstring = newstring.concat( String.valueOf( c ) );
+		for (i = 0; i < strlen; i++) {
+			char c = chars[(int) Math.floor(rand.nextDouble() * 79)];
+			newstring = newstring.concat(String.valueOf(c));
 		}
 		return newstring;
 	}
 
-	protected  String getRandomAString(int length)
-	{
+	protected String getRandomAString(int length) {
 		String newstring = new String();
 		int i;
-		final char[] chars = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
-		        'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
-		        'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
-		        'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
-		        'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', '#', '$', '%', '^',
-		        '&', '*', '(', ')', '_', '-', '=', '+', '{', '}', '[', ']',
-		        '|', ':', ';', ',', '.', '?', '/', '~', ' ' }; // 79 characters
-		for ( i = 0; i < length; i++ )
-		{
-			char c = chars[(int) Math.floor( rand.nextDouble() * 79 )];
-			newstring = newstring.concat( String.valueOf( c ) );
+		final char[] chars = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
+				'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
+				'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+				'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
+				'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', '#', '$', '%',
+				'^', '&', '*', '(', ')', '_', '-', '=', '+', '{', '}', '[',
+				']', '|', ':', ';', ',', '.', '?', '/', '~', ' ' }; // 79
+																	// characters
+		for (i = 0; i < length; i++) {
+			char c = chars[(int) Math.floor(rand.nextDouble() * 79)];
+			newstring = newstring.concat(String.valueOf(c));
 		}
 		return newstring;
 	}
 
-	protected  int getRandomNString(int num_digits)
-	{
+	protected int getRandomNString(int num_digits) {
 		int return_num = 0;
-		for ( int i = 0; i < num_digits; i++ )
-		{
-			return_num += getRandomInt( 0, 9 )
-			        * (int) java.lang.Math.pow( 10.0, (double) i );
+		for (int i = 0; i < num_digits; i++) {
+			return_num += getRandomInt(0, 9)
+					* (int) java.lang.Math.pow(10.0, (double) i);
 		}
 		return return_num;
 	}
 
-	protected  int getRandomNString(int min, int max)
-	{
-		int strlen = (int) Math
-		        .floor( rand.nextDouble() * ( ( max - min ) + 1 ) ) + min;
-		return getRandomNString( strlen );
+	protected int getRandomNString(int min, int max) {
+		int strlen = (int) Math.floor(rand.nextDouble() * ((max - min) + 1))
+				+ min;
+		return getRandomNString(strlen);
 	}
 
-	protected  int getRandomInt(int lower, int upper)
-	{
+	protected int getRandomInt(int lower, int upper) {
 
-		int num = (int) Math.floor( rand.nextDouble()
-		        * ( ( upper + 1 ) - lower ) );
-		if ( num + lower > upper || num + lower < lower )
-		{
-			System.out.println( "ERROR: Random returned value of of range!" );
-			System.exit( 1 );
+		int num = (int) Math.floor(rand.nextDouble() * ((upper + 1) - lower));
+		if (num + lower > upper || num + lower < lower) {
+			System.out.println("ERROR: Random returned value of of range!");
+			System.exit(1);
 		}
 		return num + lower;
 	}
 
-	protected  String DigSyl(int D, int N)
-	{
+	protected String DigSyl(int D, int N) {
 		int i;
 		String resultString = new String();
-		String Dstr = Integer.toString( D );
+		String Dstr = Integer.toString(D);
 
-		if ( N > Dstr.length() )
-		{
+		if (N > Dstr.length()) {
 			int padding = N - Dstr.length();
-			for ( i = 0; i < padding; i++ )
-				resultString = resultString.concat( "BA" );
+			for (i = 0; i < padding; i++)
+				resultString = resultString.concat("BA");
 		}
 
-		for ( i = 0; i < Dstr.length(); i++ )
-		{
-			if ( Dstr.charAt( i ) == '0' )
-				resultString = resultString.concat( "BA" );
-			else if ( Dstr.charAt( i ) == '1' )
-				resultString = resultString.concat( "OG" );
-			else if ( Dstr.charAt( i ) == '2' )
-				resultString = resultString.concat( "AL" );
-			else if ( Dstr.charAt( i ) == '3' )
-				resultString = resultString.concat( "RI" );
-			else if ( Dstr.charAt( i ) == '4' )
-				resultString = resultString.concat( "RE" );
-			else if ( Dstr.charAt( i ) == '5' )
-				resultString = resultString.concat( "SE" );
-			else if ( Dstr.charAt( i ) == '6' )
-				resultString = resultString.concat( "AT" );
-			else if ( Dstr.charAt( i ) == '7' )
-				resultString = resultString.concat( "UL" );
-			else if ( Dstr.charAt( i ) == '8' )
-				resultString = resultString.concat( "IN" );
-			else if ( Dstr.charAt( i ) == '9' )
-				resultString = resultString.concat( "NG" );
+		for (i = 0; i < Dstr.length(); i++) {
+			if (Dstr.charAt(i) == '0')
+				resultString = resultString.concat("BA");
+			else if (Dstr.charAt(i) == '1')
+				resultString = resultString.concat("OG");
+			else if (Dstr.charAt(i) == '2')
+				resultString = resultString.concat("AL");
+			else if (Dstr.charAt(i) == '3')
+				resultString = resultString.concat("RI");
+			else if (Dstr.charAt(i) == '4')
+				resultString = resultString.concat("RE");
+			else if (Dstr.charAt(i) == '5')
+				resultString = resultString.concat("SE");
+			else if (Dstr.charAt(i) == '6')
+				resultString = resultString.concat("AT");
+			else if (Dstr.charAt(i) == '7')
+				resultString = resultString.concat("UL");
+			else if (Dstr.charAt(i) == '8')
+				resultString = resultString.concat("IN");
+			else if (Dstr.charAt(i) == '9')
+				resultString = resultString.concat("NG");
 		}
 
 		return resultString;
 	}
-	
+
 	@Override
-	@Transactional(readOnly=false)
-    public void populateCountryTable()
-	{
-		String[] countries = {"United States", "United Kingdom", "Canada",
-		        "Germany", "France", "Japan", "Netherlands", "Italy",
-		        "Switzerland", "Australia", "Algeria", "Argentina", "Armenia",
-		        "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangla Desh",
-		        "Barbados", "Belarus", "Belgium", "Bermuda", "Bolivia",
-		        "Botswana", "Brazil", "Bulgaria", "Cayman Islands", "Chad",
-		        "Chile", "China", "Christmas Island", "Colombia", "Croatia",
-		        "Cuba", "Cyprus", "Czech Republic", "Denmark",
-		        "Dominican Republic", "Eastern Caribbean", "Ecuador", "Egypt",
-		        "El Salvador", "Estonia", "Ethiopia", "Falkland Island",
-		        "Faroe Island", "Fiji", "Finland", "Gabon", "Gibraltar",
-		        "Greece", "Guam", "Hong Kong", "Hungary", "Iceland", "India",
-		        "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Jamaica",
-		        "Jordan", "Kazakhstan", "Kuwait", "Lebanon", "Luxembourg",
-		        "Malaysia", "Mexico", "Mauritius", "New Zealand", "Norway",
-		        "Pakistan", "Philippines", "Poland", "Portugal", "Romania",
-		        "Russia", "Saudi Arabia", "Singapore", "Slovakia",
-		        "South Africa", "South Korea", "Spain", "Sudan", "Sweden",
-		        "Taiwan", "Thailand", "Trinidad", "Turkey", "Venezuela",
-		        "Zambia" };
-
-		double[] exchanges = {1, .625461, 1.46712, 1.86125, 6.24238, 121.907,
-		        2.09715, 1842.64, 1.51645, 1.54208, 65.3851, 0.998, 540.92,
-		        13.0949, 3977, 1, .3757, 48.65, 2, 248000, 38.3892, 1, 5.74,
-		        4.7304, 1.71, 1846, .8282, 627.1999, 494.2, 8.278, 1.5391,
-		        1677, 7.3044, 23, .543, 36.0127, 7.0707, 15.8, 2.7, 9600,
-		        3.33771, 8.7, 14.9912, 7.7, .6255, 7.124, 1.9724, 5.65822,
-		        627.1999, .6255, 309.214, 1, 7.75473, 237.23, 74.147, 42.75,
-		        8100, 3000, .3083, .749481, 4.12, 37.4, 0.708, 150, .3062,
-		        1502, 38.3892, 3.8, 9.6287, 25.245, 1.87539, 7.83101, 52,
-		        37.8501, 3.9525, 190.788, 15180.2, 24.43, 3.7501, 1.72929,
-		        43.9642, 6.25845, 1190.15, 158.34, 5.282, 8.54477, 32.77,
-		        37.1414, 6.1764, 401500, 596, 2447.7 };
-
-		String[] currencies = {"Dollars", "Pounds", "Dollars",
-		        "Deutsche Marks", "Francs", "Yen", "Guilders", "Lira",
-		        "Francs", "Dollars", "Dinars", "Pesos", "Dram", "Schillings",
-		        "Manat", "Dollars", "Dinar", "Taka", "Dollars", "Rouble",
-		        "Francs", "Dollars", "Boliviano", "Pula", "Real", "Lev",
-		        "Dollars", "Franc", "Pesos", "Yuan Renmimbi", "Dollars",
-		        "Pesos", "Kuna", "Pesos", "Pounds", "Koruna", "Kroner",
-		        "Pesos", "Dollars", "Sucre", "Pounds", "Colon", "Kroon",
-		        "Birr", "Pound", "Krone", "Dollars", "Markka", "Franc",
-		        "Pound", "Drachmas", "Dollars", "Dollars", "Forint", "Krona",
-		        "Rupees", "Rupiah", "Rial", "Dinar", "Punt", "Shekels",
-		        "Dollars", "Dinar", "Tenge", "Dinar", "Pounds", "Francs",
-		        "Ringgit", "Pesos", "Rupees", "Dollars", "Kroner", "Rupees",
-		        "Pesos", "Zloty", "Escudo", "Leu", "Rubles", "Riyal",
-		        "Dollars", "Koruna", "Rand", "Won", "Pesetas", "Dinar",
-		        "Krona", "Dollars", "Baht", "Dollars", "Lira", "Bolivar",
-		        "Kwacha" };
+	public void populateCountryTable() {
+		String[] countries = { "United States", "United Kingdom", "Canada",
+				"Germany", "France", "Japan", "Netherlands", "Italy",
+				"Switzerland", "Australia", "Algeria", "Argentina", "Armenia",
+				"Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangla Desh",
+				"Barbados", "Belarus", "Belgium", "Bermuda", "Bolivia",
+				"Botswana", "Brazil", "Bulgaria", "Cayman Islands", "Chad",
+				"Chile", "China", "Christmas Island", "Colombia", "Croatia",
+				"Cuba", "Cyprus", "Czech Republic", "Denmark",
+				"Dominican Republic", "Eastern Caribbean", "Ecuador", "Egypt",
+				"El Salvador", "Estonia", "Ethiopia", "Falkland Island",
+				"Faroe Island", "Fiji", "Finland", "Gabon", "Gibraltar",
+				"Greece", "Guam", "Hong Kong", "Hungary", "Iceland", "India",
+				"Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Jamaica",
+				"Jordan", "Kazakhstan", "Kuwait", "Lebanon", "Luxembourg",
+				"Malaysia", "Mexico", "Mauritius", "New Zealand", "Norway",
+				"Pakistan", "Philippines", "Poland", "Portugal", "Romania",
+				"Russia", "Saudi Arabia", "Singapore", "Slovakia",
+				"South Africa", "South Korea", "Spain", "Sudan", "Sweden",
+				"Taiwan", "Thailand", "Trinidad", "Turkey", "Venezuela",
+				"Zambia" };
+
+		double[] exchanges = { 1, .625461, 1.46712, 1.86125, 6.24238, 121.907,
+				2.09715, 1842.64, 1.51645, 1.54208, 65.3851, 0.998, 540.92,
+				13.0949, 3977, 1, .3757, 48.65, 2, 248000, 38.3892, 1, 5.74,
+				4.7304, 1.71, 1846, .8282, 627.1999, 494.2, 8.278, 1.5391,
+				1677, 7.3044, 23, .543, 36.0127, 7.0707, 15.8, 2.7, 9600,
+				3.33771, 8.7, 14.9912, 7.7, .6255, 7.124, 1.9724, 5.65822,
+				627.1999, .6255, 309.214, 1, 7.75473, 237.23, 74.147, 42.75,
+				8100, 3000, .3083, .749481, 4.12, 37.4, 0.708, 150, .3062,
+				1502, 38.3892, 3.8, 9.6287, 25.245, 1.87539, 7.83101, 52,
+				37.8501, 3.9525, 190.788, 15180.2, 24.43, 3.7501, 1.72929,
+				43.9642, 6.25845, 1190.15, 158.34, 5.282, 8.54477, 32.77,
+				37.1414, 6.1764, 401500, 596, 2447.7 };
+
+		String[] currencies = { "Dollars", "Pounds", "Dollars",
+				"Deutsche Marks", "Francs", "Yen", "Guilders", "Lira",
+				"Francs", "Dollars", "Dinars", "Pesos", "Dram", "Schillings",
+				"Manat", "Dollars", "Dinar", "Taka", "Dollars", "Rouble",
+				"Francs", "Dollars", "Boliviano", "Pula", "Real", "Lev",
+				"Dollars", "Franc", "Pesos", "Yuan Renmimbi", "Dollars",
+				"Pesos", "Kuna", "Pesos", "Pounds", "Koruna", "Kroner",
+				"Pesos", "Dollars", "Sucre", "Pounds", "Colon", "Kroon",
+				"Birr", "Pound", "Krone", "Dollars", "Markka", "Franc",
+				"Pound", "Drachmas", "Dollars", "Dollars", "Forint", "Krona",
+				"Rupees", "Rupiah", "Rial", "Dinar", "Punt", "Shekels",
+				"Dollars", "Dinar", "Tenge", "Dinar", "Pounds", "Francs",
+				"Ringgit", "Pesos", "Rupees", "Dollars", "Kroner", "Rupees",
+				"Pesos", "Zloty", "Escudo", "Leu", "Rubles", "Riyal",
+				"Dollars", "Koruna", "Rand", "Won", "Pesetas", "Dinar",
+				"Krona", "Dollars", "Baht", "Dollars", "Lira", "Bolivar",
+				"Kwacha" };
 
 		int NUM_COUNTRIES = 92;
 
-		System.out.println( "Populating COUNTRY with " + NUM_COUNTRIES
-		        + " countries" );
-		
-		ICountryDao countryDao = db.getCountryDaoImpl();
-		countryDao.createTable();
-		
-		for ( int i = 1; i <= NUM_COUNTRIES; i++ )
-		{
+		System.out.println("Populating COUNTRY with " + NUM_COUNTRIES
+				+ " countries");
+
+		ICountryDao countryDao = service.getCountryDaoImpl();
+
+		for (int i = 1; i <= NUM_COUNTRIES; i++) {
 			ICountry c = countryDao.getObject();
-			
-			if( db instanceof MongoService)
-			{
-				c.setCoId( i );
+
+			if (service instanceof MongoService) {
+				c.setCoId(i);
 			}
-			c.setCoName( countries[i - 1] );
-			c.setCoExchange( exchanges[i - 1] );
-			c.setCoCurrency( currencies[i - 1] );
+			c.setCoName(countries[i - 1]);
+			c.setCoExchange(exchanges[i - 1]);
+			c.setCoCurrency(currencies[i - 1]);
 
-			countryDao.shrani( c );
+			countryDao.shrani(c);
 		}
 
 		countryDao.finish();
 
-		//System.out.println( "" );
-    }
-
+		// System.out.println( "" );
+	}
 
 	@Override
-    public void populateAuthorTable()
-    {
+	public void populateAuthorTable() {
 		String A_FNAME, A_MNAME, A_LNAME, A_BIO;
 		java.sql.Date A_DOB;
 		GregorianCalendar cal;
 
-		System.out.println( "Populating AUTHOR Table with " + NUM_AUTHORS
-		        + " authors" );
-		
-		IAuthorDao authorDao = db.getAuthorDaoImpl();
-		
-		for ( int i = 1; i <= NUM_AUTHORS; i++ )
-		{
+		System.out.println("Populating AUTHOR Table with " + NUM_AUTHORS
+				+ " authors");
+
+		IAuthorDao authorDao = service.getAuthorDaoImpl();
+
+		for (int i = 1; i <= NUM_AUTHORS; i++) {
 			IAuthor a = authorDao.getObject();
 
 			int month, day, year, maxday;
-			A_FNAME = getRandomAString( 3, 20 );
-			A_MNAME = getRandomAString( 1, 20 );
-			A_LNAME = getRandomAString( 1, 20 );
-			year = getRandomInt( 1800, 1990 );
-			month = getRandomInt( 0, 11 );
+			A_FNAME = getRandomAString(3, 20);
+			A_MNAME = getRandomAString(1, 20);
+			A_LNAME = getRandomAString(1, 20);
+			year = getRandomInt(1800, 1990);
+			month = getRandomInt(0, 11);
 			maxday = 31;
-			if ( month == 3 | month == 5 | month == 8 | month == 10 )
+			if (month == 3 | month == 5 | month == 8 | month == 10)
 				maxday = 30;
-			else if ( month == 1 )
+			else if (month == 1)
 				maxday = 28;
-			day = getRandomInt( 1, maxday );
-			cal = new GregorianCalendar( year, month, day );
-			A_DOB = new java.sql.Date( cal.getTime().getTime() );
-			A_BIO = getRandomAString( 125, 500 );
-
-			// MongoDB doesn't have autoincrement field so we must set ID manually
-			if( db instanceof MongoService)
-			{
-				a.setAId( i );
+			day = getRandomInt(1, maxday);
+			cal = new GregorianCalendar(year, month, day);
+			A_DOB = new java.sql.Date(cal.getTime().getTime());
+			A_BIO = getRandomAString(125, 500);
+
+			// MongoDB doesn't have autoincrement field so we must set ID
+			// manually
+			if (service instanceof MongoService) {
+				a.setAId(i);
 			}
-			a.setAFname( A_FNAME );
-			a.setALname( A_LNAME );
-			a.setAMname( A_MNAME );
-			a.setADob( A_DOB );
-			a.setABio( A_BIO );
+			a.setAFname(A_FNAME);
+			a.setALname(A_LNAME);
+			a.setAMname(A_MNAME);
+			a.setADob(A_DOB);
+			a.setABio(A_BIO);
 
-			authorDao.shrani( a );
+			authorDao.shrani(a);
 		}
 
 		authorDao.finish();
 
-		System.out.println( "" );    
-    }
-
+		System.out.println("");
+	}
 
 	@Override
-    public void populateAddressTable()
-    {
-		System.out.println( "Populating ADDRESS Table with " + NUM_ADDRESSES
-		        + " addresses" );
-		System.out.print( "Complete (in 10,000's): " );
+	public void populateAddressTable() {
+		System.out.println("Populating ADDRESS Table with " + NUM_ADDRESSES
+				+ " addresses");
+		System.out.print("Complete (in 10,000's): ");
 		String ADDR_STREET1, ADDR_STREET2, ADDR_CITY, ADDR_STATE;
 		String ADDR_ZIP;
 		int ADDR_CO_ID;
-		
-		IAddressDao addressDao = db.getAddressDaoImpl();
-		ICountryDao countryDao = db.getCountryDaoImpl();
 
-		for ( int i = 1; i <= NUM_ADDRESSES; i++ )
-		{
+		IAddressDao addressDao = service.getAddressDaoImpl();
+		ICountryDao countryDao = service.getCountryDaoImpl();
+
+		for (int i = 1; i <= NUM_ADDRESSES; i++) {
 			IAddress a = addressDao.getObject();
 
-			if ( i % 10000 == 0 )
-				System.out.print( i / 10000 + " " );
+			if (i % 10000 == 0)
+				System.out.print(i / 10000 + " ");
 
-			ADDR_STREET1 = getRandomAString( 15, 40 );
-			ADDR_STREET2 = getRandomAString( 15, 40 );
-			ADDR_CITY = getRandomAString( 4, 30 );
-			ADDR_STATE = getRandomAString( 2, 20 );
-			ADDR_ZIP = getRandomAString( 5, 10 );
-			ADDR_CO_ID = getRandomInt( 1, 92 );
+			ADDR_STREET1 = getRandomAString(15, 40);
+			ADDR_STREET2 = getRandomAString(15, 40);
+			ADDR_CITY = getRandomAString(4, 30);
+			ADDR_STATE = getRandomAString(2, 20);
+			ADDR_ZIP = getRandomAString(5, 10);
+			ADDR_CO_ID = getRandomInt(1, 92);
 
-			// MongoDB doesn't have autoincrement field so we must set ID manually
-			if( db instanceof MongoService)
-			{
-				a.setAddrId( i );
+			// MongoDB doesn't have autoincrement field so we must set ID
+			// manually
+			if (service instanceof MongoService) {
+				a.setAddrId(i);
 			}
-			a.setAddrStreet1( ADDR_STREET1 );
-			a.setAddrStreet2( ADDR_STREET2 );
-			a.setAddrCity( ADDR_CITY );
-			a.setAddrState( ADDR_STATE );
-			a.setAddrZip( ADDR_ZIP );
-			a.setCountry( countryDao.findById( ADDR_CO_ID ) );
-
-			addressDao.shrani( a );
+			a.setAddrStreet1(ADDR_STREET1);
+			a.setAddrStreet2(ADDR_STREET2);
+			a.setAddrCity(ADDR_CITY);
+			a.setAddrState(ADDR_STATE);
+			a.setAddrZip(ADDR_ZIP);
+			a.setCountry(countryDao.findById(ADDR_CO_ID));
+
+			addressDao.shrani(a);
 		}
 
 		addressDao.finish();
 
-		System.out.println( "" );
-    }
-
+		System.out.println("");
+	}
 
 	@Override
-    public void populateCustomerTable()
-    {
+	public void populateCustomerTable() {
 		String C_UNAME, C_PASSWD, C_LNAME, C_FNAME;
 		int C_ADDR_ID, C_PHONE;
 		String C_EMAIL;
@@ -376,93 +348,90 @@ public abstract class AGenerate implements IGenerate
 		String C_DATA;
 		int i;
 
-		System.out.println( "Populating CUSTOMER Table with " + NUM_CUSTOMERS
-		        + " customers" );
-		System.out.print( "Complete (in 10,000's): " );
-		
-		ICustomerDao customerDao = db.getCustomerDaoImpl();
-		IAddressDao addressDao = db.getAddressDaoImpl();
+		System.out.println("Populating CUSTOMER Table with " + NUM_CUSTOMERS
+				+ " customers");
+		System.out.print("Complete (in 10,000's): ");
 
-		for ( i = 1; i <= NUM_CUSTOMERS; i++ )
-		{
+		ICustomerDao customerDao = service.getCustomerDaoImpl();
+		IAddressDao addressDao = service.getAddressDaoImpl();
+
+		for (i = 1; i <= NUM_CUSTOMERS; i++) {
 			ICustomer c = customerDao.getObject();
 
-			if ( i % 10000 == 0 )
-				System.out.print( i / 10000 + " " );
-			
-			C_UNAME = DigSyl( i, 0 ).toLowerCase();
+			if (i % 10000 == 0)
+				System.out.print(i / 10000 + " ");
+
+			C_UNAME = DigSyl(i, 0).toLowerCase();
 			C_PASSWD = C_UNAME.toLowerCase();
-			C_LNAME = getRandomAString( 8, 15 );
-			C_FNAME = getRandomAString( 8, 15 );
-			C_ADDR_ID = getRandomInt( 1, NUM_ADDRESSES );
-			C_PHONE = getRandomNString( 9, 16 );
-			C_EMAIL = C_UNAME + "@" + getRandomAString( 2, 9 ) + ".com";
+			C_LNAME = getRandomAString(8, 15);
+			C_FNAME = getRandomAString(8, 15);
+			C_ADDR_ID = getRandomInt(1, NUM_ADDRESSES);
+			C_PHONE = getRandomNString(9, 16);
+			C_EMAIL = C_UNAME + "@" + getRandomAString(2, 9) + ".com";
 
 			GregorianCalendar cal = new GregorianCalendar();
-			cal.add( Calendar.DAY_OF_YEAR, -1 * getRandomInt( 1, 730 ) );
-			C_SINCE = new java.sql.Date( cal.getTime().getTime() );
-			cal.add( Calendar.DAY_OF_YEAR, getRandomInt( 0, 60 ) );
-			if ( cal.after( new GregorianCalendar() ) )
+			cal.add(Calendar.DAY_OF_YEAR, -1 * getRandomInt(1, 730));
+			C_SINCE = new java.sql.Date(cal.getTime().getTime());
+			cal.add(Calendar.DAY_OF_YEAR, getRandomInt(0, 60));
+			if (cal.after(new GregorianCalendar()))
 				cal = new GregorianCalendar();
 
-			C_LAST_LOGIN = new java.sql.Date( cal.getTime().getTime() );
-			C_LOGIN = new java.sql.Timestamp( System.currentTimeMillis() );
+			C_LAST_LOGIN = new java.sql.Date(cal.getTime().getTime());
+			C_LOGIN = new java.sql.Timestamp(System.currentTimeMillis());
 			cal = new GregorianCalendar();
-			cal.add( Calendar.HOUR, 2 );
-			C_EXPIRATION = new java.sql.Timestamp( cal.getTime().getTime() );
+			cal.add(Calendar.HOUR, 2);
+			C_EXPIRATION = new java.sql.Timestamp(cal.getTime().getTime());
 
-			C_DISCOUNT = (double) getRandomInt( 0, 50 ) / 100.0;
+			C_DISCOUNT = (double) getRandomInt(0, 50) / 100.0;
 			C_BALANCE = 0.00;
-			C_YTD_PMT = (double) getRandomInt( 0, 99999 ) / 100.0;
-			int year = getRandomInt( 1880, 2000 );
-			int month = getRandomInt( 0, 11 );
+			C_YTD_PMT = (double) getRandomInt(0, 99999) / 100.0;
+			int year = getRandomInt(1880, 2000);
+			int month = getRandomInt(0, 11);
 			int maxday = 31;
 			int day;
-			if ( month == 3 | month == 5 | month == 8 | month == 10 )
+			if (month == 3 | month == 5 | month == 8 | month == 10)
 				maxday = 30;
-			else if ( month == 1 )
+			else if (month == 1)
 				maxday = 28;
-			day = getRandomInt( 1, maxday );
-			cal = new GregorianCalendar( year, month, day );
-			C_BIRTHDATE = new java.sql.Date( cal.getTime().getTime() );
-
-			C_DATA = getRandomAString( 100, 500 );
-
-			// MongoDB doesn't have autoincrement field so we must set ID manually
-    		if( db instanceof MongoService)
-    		{
-    			c.setCId( i );
-    		}
-			c.setCUname( C_UNAME );
-			c.setCPasswd( C_PASSWD );
-			c.setCFname( C_FNAME );
-			c.setCLname( C_LNAME );
-			IAddress addr = addressDao.findById( C_ADDR_ID );
-			c.setAddress( addr );
-			c.setCPhone( String.valueOf( C_PHONE ) );
-			c.setCEmail( C_EMAIL );
-			c.setCSince( C_SINCE );
-			c.setCLastVisit( C_LAST_LOGIN );
-			c.setCLogin( C_LOGIN );
-			c.setCExpiration( C_EXPIRATION );
-			c.setCDiscount( C_DISCOUNT );
-			c.setCBalance( C_BALANCE );
-			c.setCYtdPmt( C_YTD_PMT );
-			c.setCBirthdate( C_BIRTHDATE );
-			c.setCData( C_DATA );
-
-			customerDao.shrani( c );
+			day = getRandomInt(1, maxday);
+			cal = new GregorianCalendar(year, month, day);
+			C_BIRTHDATE = new java.sql.Date(cal.getTime().getTime());
+
+			C_DATA = getRandomAString(100, 500);
+
+			// MongoDB doesn't have autoincrement field so we must set ID
+			// manually
+			if (service instanceof MongoService) {
+				c.setCId(i);
+			}
+			c.setCUname(C_UNAME);
+			c.setCPasswd(C_PASSWD);
+			c.setCFname(C_FNAME);
+			c.setCLname(C_LNAME);
+			IAddress addr = addressDao.findById(C_ADDR_ID);
+			c.setAddress(addr);
+			c.setCPhone(String.valueOf(C_PHONE));
+			c.setCEmail(C_EMAIL);
+			c.setCSince(C_SINCE);
+			c.setCLastVisit(C_LAST_LOGIN);
+			c.setCLogin(C_LOGIN);
+			c.setCExpiration(C_EXPIRATION);
+			c.setCDiscount(C_DISCOUNT);
+			c.setCBalance(C_BALANCE);
+			c.setCYtdPmt(C_YTD_PMT);
+			c.setCBirthdate(C_BIRTHDATE);
+			c.setCData(C_DATA);
+
+			customerDao.shrani(c);
 		}
 
 		customerDao.finish();
 
-		//System.out.print( "\n" );
-    }
-
+		// System.out.print( "\n" );
+	}
 
 	@Override
-    public void populateItemTable()
-    {
+	public void populateItemTable() {
 		String I_TITLE;
 		GregorianCalendar cal;
 		int I_A_ID;
@@ -478,130 +447,125 @@ public abstract class AGenerate implements IGenerate
 		String I_BACKING;
 		String I_DIMENSIONS;
 
-		String[] SUBJECTS = {"ARTS", "BIOGRAPHIES", "BUSINESS", "CHILDREN",
-		        "COMPUTERS", "COOKING", "HEALTH", "HISTORY", "HOME", "HUMOR",
-		        "LITERATURE", "MYSTERY", "NON-FICTION", "PARENTING",
-		        "POLITICS", "REFERENCE", "RELIGION", "ROMANCE", "SELF-HELP",
-		        "SCIENCE-NATURE", "SCIENCE-FICTION", "SPORTS", "YOUTH",
-		        "TRAVEL" };
+		String[] SUBJECTS = { "ARTS", "BIOGRAPHIES", "BUSINESS", "CHILDREN",
+				"COMPUTERS", "COOKING", "HEALTH", "HISTORY", "HOME", "HUMOR",
+				"LITERATURE", "MYSTERY", "NON-FICTION", "PARENTING",
+				"POLITICS", "REFERENCE", "RELIGION", "ROMANCE", "SELF-HELP",
+				"SCIENCE-NATURE", "SCIENCE-FICTION", "SPORTS", "YOUTH",
+				"TRAVEL" };
 		int NUM_SUBJECTS = 24;
 
-		String[] BACKINGS = {"HARDBACK", "PAPERBACK", "USED", "AUDIO",
-		        "LIMITED-EDITION" };
+		String[] BACKINGS = { "HARDBACK", "PAPERBACK", "USED", "AUDIO",
+				"LIMITED-EDITION" };
 		int NUM_BACKINGS = 5;
 
-		System.out.println( "Populating ITEM table with " + NUM_ITEMS
-		        + " items" );
-		
-		IItemDao itemDao = db.getItemDaoImpl();
-		IAuthorDao authorDao = db.getAuthorDaoImpl();
-		
+		System.out
+				.println("Populating ITEM table with " + NUM_ITEMS + " items");
+
+		IItemDao itemDao = service.getItemDaoImpl();
+		IAuthorDao authorDao = service.getAuthorDaoImpl();
+
 		Random rand = new Random();
-		
-		for ( int i = 1; i <= NUM_ITEMS; i++ )
-		{
+
+		for (int i = 1; i <= NUM_ITEMS; i++) {
 			I_RANDOM = rand.nextDouble();
 			int month, day, year, maxday;
-			I_TITLE = getRandomAString( 14, 60 );
-			if ( i <= ( NUM_ITEMS / 4 ) )
+			I_TITLE = getRandomAString(14, 60);
+			if (i <= (NUM_ITEMS / 4))
 				I_A_ID = i;
 			else
-				I_A_ID = getRandomInt( 1, NUM_ITEMS / 4 );
+				I_A_ID = getRandomInt(1, NUM_ITEMS / 4);
 
-			year = getRandomInt( 1930, 2000 );
-			month = getRandomInt( 0, 11 );
+			year = getRandomInt(1930, 2000);
+			month = getRandomInt(0, 11);
 			maxday = 31;
-			if ( month == 3 | month == 5 | month == 8 | month == 10 )
+			if (month == 3 | month == 5 | month == 8 | month == 10)
 				maxday = 30;
-			else if ( month == 1 )
+			else if (month == 1)
 				maxday = 28;
-			day = getRandomInt( 1, maxday );
-			cal = new GregorianCalendar( year, month, day );
-			I_PUB_DATE = new java.sql.Date( cal.getTime().getTime() );
-
-			I_PUBLISHER = getRandomAString( 14, 60 );
-			I_SUBJECT = SUBJECTS[getRandomInt( 0, NUM_SUBJECTS - 1 )];
-			I_DESC = getRandomAString( 100, 500 );
-
-			I_RELATED1 = getRandomInt( 1, NUM_ITEMS );
-			do
-			{
-				I_RELATED2 = getRandomInt( 1, NUM_ITEMS );
-			}
-			while ( I_RELATED2 == I_RELATED1 );
-			do
-			{
-				I_RELATED3 = getRandomInt( 1, NUM_ITEMS );
-			}
-			while ( I_RELATED3 == I_RELATED1 || I_RELATED3 == I_RELATED2 );
-			do
-			{
-				I_RELATED4 = getRandomInt( 1, NUM_ITEMS );
-			}
-			while ( I_RELATED4 == I_RELATED1 || I_RELATED4 == I_RELATED2
-			        || I_RELATED4 == I_RELATED3 );
-			do
-			{
-				I_RELATED5 = getRandomInt( 1, NUM_ITEMS );
-			}
-			while ( I_RELATED5 == I_RELATED1 || I_RELATED5 == I_RELATED2
-			        || I_RELATED5 == I_RELATED3 || I_RELATED5 == I_RELATED4 );
-
-			I_THUMBNAIL = new String( "img" + i % 100 + "/thumb_" + i + ".gif" );
-			I_IMAGE = new String( "img" + i % 100 + "/image_" + i + ".gif" );
-			I_SRP = (double) getRandomInt( 100, 99999 );
+			day = getRandomInt(1, maxday);
+			cal = new GregorianCalendar(year, month, day);
+			I_PUB_DATE = new java.sql.Date(cal.getTime().getTime());
+
+			I_PUBLISHER = getRandomAString(14, 60);
+			I_SUBJECT = SUBJECTS[getRandomInt(0, NUM_SUBJECTS - 1)];
+			I_DESC = getRandomAString(100, 500);
+
+			I_RELATED1 = getRandomInt(1, NUM_ITEMS);
+			do {
+				I_RELATED2 = getRandomInt(1, NUM_ITEMS);
+			} while (I_RELATED2 == I_RELATED1);
+			do {
+				I_RELATED3 = getRandomInt(1, NUM_ITEMS);
+			} while (I_RELATED3 == I_RELATED1 || I_RELATED3 == I_RELATED2);
+			do {
+				I_RELATED4 = getRandomInt(1, NUM_ITEMS);
+			} while (I_RELATED4 == I_RELATED1 || I_RELATED4 == I_RELATED2
+					|| I_RELATED4 == I_RELATED3);
+			do {
+				I_RELATED5 = getRandomInt(1, NUM_ITEMS);
+			} while (I_RELATED5 == I_RELATED1 || I_RELATED5 == I_RELATED2
+					|| I_RELATED5 == I_RELATED3 || I_RELATED5 == I_RELATED4);
+
+			I_THUMBNAIL = new String("img" + i % 100 + "/thumb_" + i + ".gif");
+			I_IMAGE = new String("img" + i % 100 + "/image_" + i + ".gif");
+			I_SRP = (double) getRandomInt(100, 99999);
 			I_SRP /= 100.0;
 
-			I_COST = I_SRP
-			        - ( ( ( (double) getRandomInt( 0, 50 ) / 100.0 ) ) * I_SRP );
+			I_COST = I_SRP - ((((double) getRandomInt(0, 50) / 100.0)) * I_SRP);
 
-			cal.add( Calendar.DAY_OF_YEAR, getRandomInt( 1, 30 ) );
-			I_AVAIL = new java.sql.Date( cal.getTime().getTime() );
-			I_STOCK = getRandomInt( 10, 30 );
-			I_ISBN = getRandomAString( 13 );
-			I_PAGE = getRandomInt( 20, 9999 );
-			I_BACKING = BACKINGS[getRandomInt( 0, NUM_BACKINGS - 1 )];
-			I_DIMENSIONS = ( (double) getRandomInt( 1, 9999 ) / 100.0 ) + "x"
-			        + ( (double) getRandomInt( 1, 9999 ) / 100.0 ) + "x"
-			        + ( (double) getRandomInt( 1, 9999 ) / 100.0 );
+			cal.add(Calendar.DAY_OF_YEAR, getRandomInt(1, 30));
+			I_AVAIL = new java.sql.Date(cal.getTime().getTime());
+			I_STOCK = getRandomInt(10, 30);
+			I_ISBN = getRandomAString(13);
+			I_PAGE = getRandomInt(20, 9999);
+			I_BACKING = BACKINGS[getRandomInt(0, NUM_BACKINGS - 1)];
+			I_DIMENSIONS = ((double) getRandomInt(1, 9999) / 100.0) + "x"
+					+ ((double) getRandomInt(1, 9999) / 100.0) + "x"
+					+ ((double) getRandomInt(1, 9999) / 100.0);
 
 			IItem item = itemDao.getObject();
 			// Set parameter
-			// MongoDB doesn't have autoincrement field so we must set ID manually
-			if( db instanceof MongoService)
-			{
-				item.setIId( i );
+			// MongoDB doesn't have autoincrement field so we must set ID
+			// manually
+			if (service instanceof MongoService) {
+				item.setIId(i);
 			}
-			item.setIRandom( I_RANDOM );
-			item.setITitle( I_TITLE );
-			item.setIPubDate( I_PUB_DATE );
-			item.setIPublisher( I_PUBLISHER );
-			item.setISubject( I_SUBJECT );
-			item.setIDesc( I_DESC );
-			item.setIRelated1( I_RELATED1 );
-			item.setIRelated2( I_RELATED2 );
-			item.setIRelated3( I_RELATED3 );
-			item.setIRelated4( I_RELATED4 );
-			item.setIRelated5( I_RELATED5 );
-			item.setIThumbnail( I_THUMBNAIL );
-			item.setIImage( I_IMAGE );
-			item.setISrp( I_SRP );
-			item.setICost( I_COST );
-			item.setIAvail( I_AVAIL );
-			item.setIStock( I_STOCK );
-			item.setIIsbn( I_ISBN );
-			item.setIPage( String.valueOf( I_PAGE ) );
-			item.setIBacking( I_BACKING );
-			item.setIDimension( I_DIMENSIONS );
-			item.setAuthor( authorDao.findById( I_A_ID ) );
-
-			itemDao.shrani( item );
-			
-			itemDao.findById( item.getIId() );
+			item.setIRandom(I_RANDOM);
+			item.setITitle(I_TITLE);
+			item.setIPubDate(I_PUB_DATE);
+			item.setIPublisher(I_PUBLISHER);
+			item.setISubject(I_SUBJECT);
+			item.setIDesc(I_DESC);
+			item.setIRelated1(I_RELATED1);
+			item.setIRelated2(I_RELATED2);
+			item.setIRelated3(I_RELATED3);
+			item.setIRelated4(I_RELATED4);
+			item.setIRelated5(I_RELATED5);
+			item.setIThumbnail(I_THUMBNAIL);
+			item.setIImage(I_IMAGE);
+			item.setISrp(I_SRP);
+			item.setICost(I_COST);
+			item.setIAvail(I_AVAIL);
+			item.setIStock(I_STOCK);
+			item.setIIsbn(I_ISBN);
+			item.setIPage(String.valueOf(I_PAGE));
+			item.setIBacking(I_BACKING);
+			item.setIDimension(I_DIMENSIONS);
+			item.setAuthor(authorDao.findById(I_A_ID));
+
+			itemDao.shrani(item);
+
+			itemDao.findById(item.getIId());
 		}
 
 		itemDao.finish();
-		//System.out.println( "" );
-    }
-	
+		// System.out.println( "" );
+	}
+
+	@Override
+	public void setContext(ApplicationContext ctx) {
+		this.ctx = ctx;
+		this.service = (IService) ctx.getBean("service");
+	}
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/generate/Generate.java b/application/src/main/java/eu/cloudscale/showcase/generate/Generate.java
index 5b173d0..cfd251e 100644
--- a/application/src/main/java/eu/cloudscale/showcase/generate/Generate.java
+++ b/application/src/main/java/eu/cloudscale/showcase/generate/Generate.java
@@ -3,56 +3,37 @@ package eu.cloudscale.showcase.generate;
 import java.io.IOException;
 import java.util.Properties;
 
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.support.PropertiesLoaderUtils;
 
+
+
+
 import eu.cloudscale.showcase.db.common.DatabaseHelper;
 
 public class Generate
 {
 
 	private IGenerate db;
-
-	public Generate(String dbType)
+	
+	public Generate()
 	{
 
-//		Resource resource = new ClassPathResource( "database.properties" );
-//		Properties prop = null;
-//		try
-//		{
-//			prop = PropertiesLoaderUtils.loadProperties( resource );
-//		}
-//		catch ( IOException e )
-//		{
-//			e.printStackTrace();
-//		}
-//
-//		String dbType = prop.getProperty( "jdbc.dbtype" );
-
-		if ( dbType.equalsIgnoreCase( "mongo" )
-		        || dbType.equalsIgnoreCase( "mongodb" ) )
-		{
-			db = new GenerateMongo();
-		}
-		else
-		{
-			DatabaseHelper.loadMySQLDriver();
-			db = new GenerateHibernate();
-		}
-
 	}
 
-	public void generate()
+	public void generate(IGenerate db)
 	{
 
-		//db.dropTables( tables );
-		db.populateCountryTable();
-		db.populateAuthorTable();
-		db.populateAddressTable();
-		db.populateCustomerTable();
-		db.populateItemTable();
-		db.populateOrdersAndCC_XACTSTable();
+//		 db.dropTables( tables );
+		 db.populateCountryTable();
+		 db.populateAuthorTable();
+		 db.populateAddressTable();
+		 db.populateCustomerTable();
+		 db.populateItemTable();
+		 db.populateOrdersAndCC_XACTSTable();
 		// db.createIndexes(tables);
 
 		System.out.println( "FINISHED!" );
@@ -60,12 +41,26 @@ public class Generate
 
 	public static void main(String[] args)
 	{
-		if( args.length < 1 )
-		{
-			System.out.println("Usage: $ java Generate <mysql|mongodb>");
-			System.exit(0);			
-		}
-		Generate generate = new Generate(args[0]);
-		generate.generate();
+//		if( args.length < 1 )
+//		{
+//			System.out.println("Usage: $ java Generate <mysql|mongodb>");
+//			System.exit(0);			
+//		}
+
+		ApplicationContext context = new ClassPathXmlApplicationContext("classpath:app-context.xml");
+		
+	    Generate generate = (Generate) context.getBean("generator");
+	    
+	    IGenerate gen = (IGenerate) context.getBean("generate");
+	    gen.setContext(context);
+	    try
+	    {
+			generate.generate(gen);
+	    }
+	    catch(Exception e)
+	    {
+	    	e.printStackTrace();
+	    	System.out.println("Have you uncommented <prop key=\"hibernate.hbm2ddl.auto\">create</prop> in hibernate.xml?");
+	    }
 	}
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/generate/GenerateHibernate.java b/application/src/main/java/eu/cloudscale/showcase/generate/GenerateHibernate.java
index 82b1110..3c3f6e7 100644
--- a/application/src/main/java/eu/cloudscale/showcase/generate/GenerateHibernate.java
+++ b/application/src/main/java/eu/cloudscale/showcase/generate/GenerateHibernate.java
@@ -5,6 +5,15 @@ import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.HashSet;
 
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import eu.cloudscale.showcase.db.IService;
+import eu.cloudscale.showcase.db.common.ContextHelper;
 import eu.cloudscale.showcase.db.dao.IAddressDao;
 import eu.cloudscale.showcase.db.dao.IAuthorDao;
 import eu.cloudscale.showcase.db.dao.ICcXactsDao;
@@ -20,15 +29,15 @@ import eu.cloudscale.showcase.db.model.hibernate.CcXacts;
 import eu.cloudscale.showcase.db.model.hibernate.OrderLine;
 import eu.cloudscale.showcase.db.model.hibernate.Orders;
 
-
+@Component
+@Transactional
 public class GenerateHibernate extends AGenerate
 {
 	
 	public GenerateHibernate()
 	{
-		super();
 	}
-
+	
 	@Override
     public void populateOrdersAndCC_XACTSTable()
     {
@@ -57,7 +66,7 @@ public class GenerateHibernate extends AGenerate
 		int CX_NUM;
 		String CX_NAME;
 		java.sql.Date CX_EXPIRY;
-		int CX_AUTH_ID;
+		String CX_AUTH_ID;
 		int CX_CO_ID;
 
 		System.out.println( "Populating ORDERS, ORDER_LINES, CC_XACTS with "
@@ -65,14 +74,14 @@ public class GenerateHibernate extends AGenerate
 
 		System.out.print( "Complete (in 10,000's): " );
 
-		ICustomerDao customerDao = super.db.getCustomerDaoImpl();
-		IAddressDao addressDao = super.db.getAddressDaoImpl();
-		IItemDao itemDao = super.db.getItemDaoImpl();
-		ICountryDao countryDao = super.db.getCountryDaoImpl();
-		IOrdersDao ordersDao = super.db.getOrdersDaoImpl();
-		IOrderLineDao orderLineDao = super.db.getOrderLineDaoImpl();
-		ICcXactsDao ccXactsDao = super.db.getCcXactsDaoImpl();
-		IAuthorDao authorDao = super.db.getAuthorDaoImpl();
+		ICustomerDao customerDao = super.service.getCustomerDaoImpl();
+		IAddressDao addressDao = super.service.getAddressDaoImpl();
+		IItemDao itemDao = super.service.getItemDaoImpl();
+		ICountryDao countryDao = super.service.getCountryDaoImpl();
+		IOrdersDao ordersDao = super.service.getOrdersDaoImpl();
+		IOrderLineDao orderLineDao = super.service.getOrderLineDaoImpl();
+		ICcXactsDao ccXactsDao = super.service.getCcXactsDaoImpl();
+		IAuthorDao authorDao = super.service.getAuthorDaoImpl();
 
 		for ( int i = 1; i <= NUM_ORDERS; i++ )
 		{
@@ -139,7 +148,7 @@ public class GenerateHibernate extends AGenerate
 			cal = new GregorianCalendar();
 			cal.add( Calendar.DAY_OF_YEAR, getRandomInt( 10, 730 ) );
 			CX_EXPIRY = new java.sql.Date( cal.getTime().getTime() );
-			CX_AUTH_ID = getRandomInt( 1, NUM_AUTHORS );
+			CX_AUTH_ID = getRandomAString( 15 );
 			CX_CO_ID = getRandomInt( 1, 92 );
 
 			CcXacts ccXacts = new CcXacts();
@@ -150,7 +159,7 @@ public class GenerateHibernate extends AGenerate
 			ccXacts.setCxNum( CX_NUM );
 			ccXacts.setCxName( CX_NAME );
 			ccXacts.setCxExpiry( CX_EXPIRY );
-			ccXacts.setCxAuthId( authorDao.findById( CX_AUTH_ID ));
+			ccXacts.setCxAuthId( String.valueOf(CX_AUTH_ID) );
 			ccXacts.setCxXactAmt( O_TOTAL );
 			ccXacts.setCxXactDate( O_SHIP_DATE );
 
@@ -166,4 +175,35 @@ public class GenerateHibernate extends AGenerate
 
 		System.out.println( "" );
     }
+
+	@Override
+	public void dropTables(String[] tables) 
+	{
+		SessionFactory sf = (SessionFactory) ctx.getBean("sessionFactory");
+		
+		Session session = sf.openSession();
+		Query q = session.createSQLQuery("SET FOREIGN_KEY_CHECKS=0");
+		q.executeUpdate();
+		
+		for(String table : tables)
+		{
+			// Ugly hack so that TRUNCATE TABLE works
+			q = session.createSQLQuery("CREATE TABLE  IF NOT EXISTS " + table + " (id int)");
+			q.executeUpdate();
+			
+			q = session.createSQLQuery("TRUNCATE TABLE " + table);
+			q.executeUpdate();
+			
+//			q = session.createSQLQuery("DROP TABLE IF EXISTS " + table);
+//			q.executeUpdate();
+//			System.out.println("DROPPED TABLE " + table);
+		}
+		
+		q = session.createSQLQuery("SET FOREIGN_KEY_CHECKS=1");
+		q.executeUpdate();
+		
+		session.close();
+//		sf.close();
+//		sf = null;
+	}
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/generate/GenerateMongo.java b/application/src/main/java/eu/cloudscale/showcase/generate/GenerateMongo.java
index e882b38..a6476c0 100644
--- a/application/src/main/java/eu/cloudscale/showcase/generate/GenerateMongo.java
+++ b/application/src/main/java/eu/cloudscale/showcase/generate/GenerateMongo.java
@@ -5,7 +5,11 @@ import java.util.Date;
 import java.util.GregorianCalendar;
 
 import org.omg.CosNaming._BindingIteratorImplBase;
+import org.springframework.data.mongodb.core.MongoOperations;
+import org.springframework.stereotype.Component;
 
+import eu.cloudscale.showcase.db.IService;
+import eu.cloudscale.showcase.db.common.ContextHelper;
 import eu.cloudscale.showcase.db.dao.IAddressDao;
 import eu.cloudscale.showcase.db.dao.IAuthorDao;
 import eu.cloudscale.showcase.db.dao.ICcXactsDao;
@@ -20,12 +24,13 @@ import eu.cloudscale.showcase.db.model.IOrderLine;
 import eu.cloudscale.showcase.db.model.IOrders;
 import eu.cloudscale.showcase.db.model.mongo.Item;
 
+@Component
 public class GenerateMongo extends AGenerate
 {
 	
 	public GenerateMongo()
 	{
-		super();
+
 	}
 
 	@Override
@@ -56,7 +61,7 @@ public class GenerateMongo extends AGenerate
 		int CX_NUM;
 		String CX_NAME;
 		java.sql.Date CX_EXPIRY;
-		Integer CX_AUTH_ID;
+		String CX_AUTH_ID;
 		int CX_CO_ID;
 
 		System.out.println( "Populating ORDERS, ORDER_LINES, CC_XACTS with "
@@ -64,14 +69,14 @@ public class GenerateMongo extends AGenerate
 
 		System.out.print( "Complete (in 10,000's): " );
 		
-		ICustomerDao customerDao = super.db.getCustomerDaoImpl();
-		IAuthorDao authorDao = super.db.getAuthorDaoImpl();
-		IAddressDao addressDao = super.db.getAddressDaoImpl();
-		IItemDao itemDao = super.db.getItemDaoImpl();
-		ICountryDao countryDao = super.db.getCountryDaoImpl();
-		IOrdersDao ordersDao = super.db.getOrdersDaoImpl();
-		IOrderLineDao orderLineDao = super.db.getOrderLineDaoImpl();
-		ICcXactsDao ccXactsDao = super.db.getCcXactsDaoImpl();
+		ICustomerDao customerDao = super.service.getCustomerDaoImpl();
+		IAuthorDao authorDao = super.service.getAuthorDaoImpl();
+		IAddressDao addressDao = super.service.getAddressDaoImpl();
+		IItemDao itemDao = super.service.getItemDaoImpl();
+		ICountryDao countryDao = super.service.getCountryDaoImpl();
+		IOrdersDao ordersDao = super.service.getOrdersDaoImpl();
+		IOrderLineDao orderLineDao = super.service.getOrderLineDaoImpl();
+		ICcXactsDao ccXactsDao = super.service.getCcXactsDaoImpl();
 		
 		for ( int i = 1; i <= NUM_ORDERS; i++ )
 		{
@@ -145,7 +150,7 @@ public class GenerateMongo extends AGenerate
 			cal = new GregorianCalendar();
 			cal.add( Calendar.DAY_OF_YEAR, getRandomInt( 10, 730 ) );
 			CX_EXPIRY = new java.sql.Date( cal.getTime().getTime() );
-			CX_AUTH_ID = getRandomInt( 1, NUM_AUTHORS );
+			CX_AUTH_ID = getRandomAString( 15 );
 			CX_CO_ID = getRandomInt( 1, 92 );
 					
 			ICcXacts ccXacts = ccXactsDao.getObject();
@@ -156,7 +161,7 @@ public class GenerateMongo extends AGenerate
 			ccXacts.setCxNum( CX_NUM );
 			ccXacts.setCxName( CX_NAME );
 			ccXacts.setCxExpiry( CX_EXPIRY );
-			ccXacts.setCxAuthId( authorDao.findById( CX_AUTH_ID ) );
+			ccXacts.setCxAuthId( CX_AUTH_ID );
 			ccXacts.setCxXactAmt( O_TOTAL );
 			ccXacts.setCxXactDate( O_SHIP_DATE );
 			
@@ -172,4 +177,13 @@ public class GenerateMongo extends AGenerate
 		System.out.println( "" );
     }
 
+	@Override
+	public void dropTables(String[] tables) {
+		MongoOperations mongoOperation = (MongoOperations) ctx.getBean("mongoTemplate");
+		for (String table : tables)
+		{
+			mongoOperation.dropCollection(table);
+		}
+	}
+
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/generate/IGenerate.java b/application/src/main/java/eu/cloudscale/showcase/generate/IGenerate.java
index 3d2b207..2b641f1 100644
--- a/application/src/main/java/eu/cloudscale/showcase/generate/IGenerate.java
+++ b/application/src/main/java/eu/cloudscale/showcase/generate/IGenerate.java
@@ -1,8 +1,13 @@
 package eu.cloudscale.showcase.generate;
 
+import org.springframework.context.ApplicationContext;
+
+
+
 public interface IGenerate
 {
-	
+	public void setContext(ApplicationContext ctx);
+
 	public void populateCountryTable();
 	
 	public void populateAuthorTable();
@@ -14,4 +19,6 @@ public interface IGenerate
 	public void populateItemTable();
 	
 	public void populateOrdersAndCC_XACTSTable();
+
+	public void dropTables(String[] tables);
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/AController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/AController.java
index 42d6016..6941812 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/AController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/AController.java
@@ -1,14 +1,9 @@
 package eu.cloudscale.showcase.servlets;
 
-import java.io.IOException;
 import java.util.List;
-import java.util.Properties;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PropertiesLoaderUtils;
 import org.springframework.ui.Model;
 
 import eu.cloudscale.showcase.db.IService;
@@ -84,7 +79,7 @@ public abstract class AController
 	    return getUrl2( shoppingId, customerId, "/order-inquiry" );
     }
 	
-	protected void setupFrontend(Model model, Integer shoppingId, Integer customerId)
+	protected void setupUrl(Model model, Integer shoppingId, Integer customerId)
 	{
 		String shoppingCartUrl = getShoppingCartUrl( shoppingId, customerId );
 		model.addAttribute( "shoppingCartUrl", shoppingCartUrl );
@@ -97,25 +92,7 @@ public abstract class AController
 		
 		String orderInquiryUrl = getOrderInquiryUrl(shoppingId, customerId);
 		model.addAttribute( "orderInquiryUrl", orderInquiryUrl );
-		
-		model.addAttribute( "cssResourceUrl", getApplicationProperties().get( "eu.cloudscale.files.url.css" ));
-		model.addAttribute( "imgResourceUrl", getApplicationProperties().get( "eu.cloudscale.files.url.img" ));
-		model.addAttribute( "jsResourceUrl", getApplicationProperties().get( "eu.cloudscale.files.url.js" ));
 	}
 
-	protected Properties getApplicationProperties()
-	{
-		Resource resource = new ClassPathResource("app.properties");
-		Properties props = null;
-		try
-        {
-	        props = PropertiesLoaderUtils.loadProperties(resource);
-        }
-        catch ( IOException e )
-        {
-	        e.printStackTrace();
-        }
-		
-		return props;
-	}
+	
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/BestSellersController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/BestSellersController.java
index 9f28d8f..ee56f6c 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/BestSellersController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/BestSellersController.java
@@ -28,8 +28,8 @@ public class BestSellersController extends AController
 		
 		String productUrl = getProductUrl(shoppingId, customerId);
 		model.addAttribute( "productUrl", productUrl);
-		model.addAttribute( "promotional", getPromotional() );	
-		setupFrontend( model, shoppingId, customerId );
+		
+		setupUrl( model, shoppingId, customerId );
 		
 		return "best-sellers";
 	}
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/BuyConfirmController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/BuyConfirmController.java
index e25e6e8..07eea3e 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/BuyConfirmController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/BuyConfirmController.java
@@ -86,7 +86,7 @@ public class BuyConfirmController extends AController
 		
 		model.addAttribute("errors", errors);
 		model.addAttribute("results", res);
-		setupFrontend( model, shoppingId, customerId );
+		setupUrl( model, shoppingId, customerId );
 		return "buy-confirm";
 	}
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/BuyController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/BuyController.java
index 0f38231..4eb1ca8 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/BuyController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/BuyController.java
@@ -166,10 +166,10 @@ public class BuyController extends AController
 		model.addAttribute( "cart", cart );
 		model.addAttribute( "customer", customer );
 		
-//		if( cart != null )
+		if( cart != null )
 //			model.addAttribute( "subTotal", getSubTotal( cart.getShoppingCartLines() ) );
 
-		setupFrontend(model, shoppingId, customerId);
+		setupUrl(model, shoppingId, customerId);
 		return "buy";
 	}
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/CustomerRegistrationController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/CustomerRegistrationController.java
index c3a9dd8..dd00214 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/CustomerRegistrationController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/CustomerRegistrationController.java
@@ -47,7 +47,7 @@ public class CustomerRegistrationController extends AController
 
 		model.addAttribute( "sessionId", session.getId() );
 
-		setupFrontend( model, shoppingId, customerId );
+		setupUrl( model, shoppingId, customerId );
 		return "customer-registration";
 	}
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/HomeController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/HomeController.java
index f4225e1..5a15c28 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/HomeController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/HomeController.java
@@ -50,22 +50,29 @@ public class HomeController extends AController
 	        @RequestParam( value = "C_ID", required = false ) Integer customerId,
 	        Locale locale, HttpServletRequest request, Model model)
 	{
-		HttpSession session = request.getSession( false );
-
-		if ( session == null )
-			session = request.getSession( true );
-
-		String categoryUrl = getUrl1( shoppingId, customerId, "" );
-
-		model.addAttribute( "promotional", getPromotional() );
-		model.addAttribute( "categories", prepareCategories( categoryUrl ) );
-
-		model.addAttribute( "categoryUrl", categoryUrl );
-
-		setupFrontend( model, shoppingId, customerId );
-
-		String productUrl = getProductUrl( shoppingId, customerId );
-		model.addAttribute( "productUrl", productUrl );
+		try 
+		{
+    		HttpSession session = request.getSession( false );
+    
+    		if ( session == null )
+    			session = request.getSession( true );
+    
+    		String categoryUrl = getUrl1( shoppingId, customerId, "" );
+    
+    		model.addAttribute( "promotional", getPromotional() );
+    		model.addAttribute( "categories", prepareCategories( categoryUrl ) );
+    
+    		model.addAttribute( "categoryUrl", categoryUrl );
+    
+    		setupUrl( model, shoppingId, customerId );
+    
+    		String productUrl = getProductUrl( shoppingId, customerId );
+    		model.addAttribute( "productUrl", productUrl );
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
 
 		return "home";
 	}
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/NewProductsController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/NewProductsController.java
index b3d48d4..1349b9e 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/NewProductsController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/NewProductsController.java
@@ -64,7 +64,7 @@ public class NewProductsController extends AController
 		model.addAttribute( "products", service.getNewProducts( category ) );
 		model.addAttribute( "promotional", getPromotional() );
 		
-		setupFrontend(model, shoppingId, customerId);
+		setupUrl(model, shoppingId, customerId);
 		return "new-products";
 	}
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java
index 98a2933..2fd1b87 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java
@@ -83,10 +83,12 @@ public class OrderDisplayController extends AController
 			model.addAttribute( "order", order );
 			model.addAttribute( "orderLines", orderLines );
 		}
+		else
+		{
+			model.addAttribute( "errors", errors);
+		}
 		
-		model.addAttribute( "errors", errors);
-		
-		setupFrontend( model, shoppingId, customerId );
+		setupUrl( model, shoppingId, customerId );
 		return "order-display";
 	}
 }
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/OrderInquiryController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/OrderInquiryController.java
index 167c360..31ba104 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/OrderInquiryController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/OrderInquiryController.java
@@ -49,7 +49,7 @@ public class OrderInquiryController extends AController
 			model.addAttribute( "shoppingId", SHOPPING_ID );
 		}
 
-		setupFrontend( model, SHOPPING_ID, C_ID );
+		setupUrl( model, SHOPPING_ID, C_ID );
 		return "order-inquiry";
 	}
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/ProductDetailServlet.java b/application/src/main/java/eu/cloudscale/showcase/servlets/ProductDetailServlet.java
index 546ee21..cd51163 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/ProductDetailServlet.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/ProductDetailServlet.java
@@ -30,21 +30,29 @@ public class ProductDetailServlet extends AController
 					Locale locale, 
 					Model model)
 	{
-		HttpSession session = request.getSession(false);
-				
-		IItemDao itemDao = service.getItemDaoImpl();
-		IItem item = itemDao.findById(itemId);
-		
-		String addToShoppingCartUrl = buildAddToShoppingCartUrl(shoppingId, customerId, itemId);
-		model.addAttribute( "addToShoppingCartUrl", addToShoppingCartUrl);
-		
-		String adminUrl = buildAdminUrl(shoppingId, customerId, itemId);
-		model.addAttribute( "adminUrl", adminUrl );
-		
-		model.addAttribute( "item", item);
-		setupFrontend( model, shoppingId, customerId );
-		
+		try 
+		{
+    		HttpSession session = request.getSession(false);
+    				
+    		IItemDao itemDao = service.getItemDaoImpl();
+    		IItem item = itemDao.findById(itemId);
+    		
+    		String addToShoppingCartUrl = buildAddToShoppingCartUrl(shoppingId, customerId, itemId);
+    		model.addAttribute( "addToShoppingCartUrl", addToShoppingCartUrl);
+    		
+    		String adminUrl = buildAdminUrl(shoppingId, customerId, itemId);
+    		model.addAttribute( "adminUrl", adminUrl );
+    		
+    		model.addAttribute( "item", item);
+    		setupUrl( model, shoppingId, customerId );
+    		
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
 		return "product_detail";
+
 	}
 
 	private String buildAddToShoppingCartUrl(Integer shoppingId, Integer customerId, Integer itemId)
@@ -52,8 +60,9 @@ public class ProductDetailServlet extends AController
 		String url = getUrl2(shoppingId, customerId, "/shopping-cart");
 		if( url.equals( "/shopping-cart" ))
 			url += "?";
-		
-		url += "&I_ID=" + itemId + "&QTY=1&ADD_FLAG=Y";
+		else
+			url += "&";
+		url += "I_ID=" + itemId + "&QTY=1&ADD_FLAG=Y";
 		return url;
     }
 
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/SearchController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/SearchController.java
index 6234843..59fa3a6 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/SearchController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/SearchController.java
@@ -20,40 +20,47 @@ public class SearchController extends AController
 	@RequestMapping( method=RequestMethod.GET )
 	public String get(HttpServletRequest request, Model model)
 	{
-	
-		HttpSession session = request.getSession(false);
-		
-		String field = request.getParameter("searchField");
-		String keyword = request.getParameter( "keyword" );
-		ArrayList<String> errors = new ArrayList<String>();
-		
-		if( keyword == null)
-		{
-			keyword = "";
-			errors.add( "Search string is empty" );
-			model.addAttribute( "errors", errors );
-		}
-		
-		if( errors.isEmpty() )
+		try 
 		{
-    		if( field.equalsIgnoreCase( "author" ))
+    		HttpSession session = request.getSession(false);
+    		
+    		String field = request.getParameter("searchField");
+    		String keyword = request.getParameter( "keyword" );
+    		ArrayList<String> errors = new ArrayList<String>();
+    		
+    		if( keyword == null)
     		{
-    			model.addAttribute( "results", service.searchByAuthor(keyword) );
+    			keyword = "";
+    			errors.add( "Search string is empty" );
+    			model.addAttribute( "errors", errors );
     		}
-    		else if( field.equalsIgnoreCase( "title" ))
+    		
+    		if( errors.isEmpty() )
     		{
-    			model.addAttribute( "results", service.searchByTitle(keyword) );
-    		}
-    		else if( field.equalsIgnoreCase( "subject" ))
-    		{
-    			model.addAttribute( "results", service.searchBySubject(keyword) );
+        		if( field.equalsIgnoreCase( "author" ))
+        		{
+        			model.addAttribute( "results", service.searchByAuthor(keyword) );
+        		}
+        		else if( field.equalsIgnoreCase( "title" ))
+        		{
+        			model.addAttribute( "results", service.searchByTitle(keyword) );
+        		}
+        		else if( field.equalsIgnoreCase( "subject" ))
+        		{
+        			model.addAttribute( "results", service.searchBySubject(keyword) );
+        		}
     		}
+    		
+    		model.addAttribute( "searchField", field );
+    		model.addAttribute( "keyword", keyword );
+    		setupUrls( model, request);
+    		return "search";
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+			return "search";
 		}
-		
-		model.addAttribute( "searchField", field );
-		model.addAttribute( "keyword", keyword );
-		setupUrls( model, request);
-		return "search";
 	}
 	
 	private void setupUrls(Model model, HttpServletRequest request)
@@ -69,7 +76,7 @@ public class SearchController extends AController
 		{
 			shoppingId = Integer.valueOf(request.getParameter( "C_ID" ));
 		}
-		setupFrontend( model, shoppingId, customerId);
+		setupUrl( model, shoppingId, customerId);
 		
 		String productUrl = getProductUrl(shoppingId, customerId);
 		model.addAttribute( "productUrl", productUrl);
diff --git a/application/src/main/java/eu/cloudscale/showcase/servlets/ShoppingCartController.java b/application/src/main/java/eu/cloudscale/showcase/servlets/ShoppingCartController.java
index e0208f1..517a64b 100644
--- a/application/src/main/java/eu/cloudscale/showcase/servlets/ShoppingCartController.java
+++ b/application/src/main/java/eu/cloudscale/showcase/servlets/ShoppingCartController.java
@@ -90,7 +90,7 @@ public class ShoppingCartController extends AController
 		}
 		
 		model.addAttribute("errors", errors);
-		setupFrontend(model, shoppingId, customerId);
+		setupUrl(model, shoppingId, customerId);
 		return "shopping-cart";
 	}
 
diff --git a/application/src/main/resources/app-context.xml b/application/src/main/resources/app-context.xml
index 8ce75c3..1a40a67 100644
--- a/application/src/main/resources/app-context.xml
+++ b/application/src/main/resources/app-context.xml
@@ -5,6 +5,7 @@
 			http://www.springframework.org/schema/beans/spring-beans.xsd">
 	
 	<!-- These variables are replaced with ones defined in pom.xml -->
-	<import resource="classpath:cache.xml" />
-	<import resource="classpath:${eu.cloudscale.datasource}.xml" />
+	<import resource="cache.xml" />
+	<import resource="${eu.cloudscale.datasource}" />
+	<bean id="generator" class="eu.cloudscale.showcase.generate.Generate" />
 </beans>
\ No newline at end of file
diff --git a/application/src/main/resources/hibernate.xml b/application/src/main/resources/hibernate.xml
index 2c2fb1f..cd264da 100644
--- a/application/src/main/resources/hibernate.xml
+++ b/application/src/main/resources/hibernate.xml
@@ -18,7 +18,7 @@
 			http://www.springframework.org/schema/cache/spring-cache.xsd">
 	
 	<context:property-placeholder
-		location="${eu.cloudscale.showcase.generate.properties}" />
+		location="classpath:database/database.hibernate.properties" />
 		
 	<context:component-scan base-package="eu.cloudscale.showcase.db.dao.hibernate" />
 
@@ -32,19 +32,16 @@
 		<property name="user" value="${jdbc.username}" />
 		<property name="password" value="${jdbc.password}" />
 		<!-- these are C3P0 properties -->
-		<property name="acquireIncrement" value="1" />
-		<property name="minPoolSize" value="4" />
-		<property name="maxPoolSize" value="570" />
-		<property name="maxIdleTime" value="30" />
-<!-- 		<property name="maxConnectionAge" value="180" /> -->
+		<property name="acquireIncrement" value="2" />
+		<property name="minPoolSize" value="5" />
+		<property name="maxPoolSize" value="${connection_pool_size}" />
+		<!-- <property name="maxIdleTime" value="30" /> -->
 		<!-- <property name="debugUnreturnedConnectionStackTraces" value="true" 
 			/> -->
-		<property name="initialPoolSize" value="4" />
-		<property name="idleConnectionTestPeriod" value="5" />
-<!-- 		<property name="checkoutTimeout" value="60000" /> -->
-<!-- 		<property name="maxIdleTimeExcessConnections" value="30" /> -->
-<!-- 		<property name="unreturnedConnectionTimeout" value="60" /> -->
-<!-- 		<property name="debugUnreturnedConnectionStackTraces" value="true" /> -->
+		<property name="initialPoolSize" value="5" />
+		<!-- <property name="idleConnectionTestPeriod" value="10" /> -->
+		<!-- <property name="checkoutTimeout" value="500" /> -->
+		<!-- <property name="unreturnedConnectionTimeout" value="30" /> -->
 		<!-- <property name="automaticTestTable" value="conTest" /> -->
 <!-- 		<property name="testConnectionOnCheckin" value="true" /> -->
 <!-- 		<property name="testConnectionOnCheckout" value="true" /> -->
@@ -52,18 +49,16 @@
 
 	<tx:annotation-driven transaction-manager="transactionManager" />
 
-	<bean id="sessionFactory"
-		class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
+	<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
 		<property name="dataSource" ref="dataSource" />
-		
 		<property name="packagesToScan" value="eu.cloudscale.showcase.db.dao" />
 		<property name="hibernateProperties">
 			<props>
-<!-- 				<prop key="hibernate.hbm2ddl.auto">create</prop> -->
 				<prop key="hibernate.jdbc.batch_size">50</prop>
 				<prop key="hibernate.show_sql">false</prop>
 				<prop key="hibernate.dialect">${jdbc.hibernate.dialect}</prop>
 				<prop key="hibernate.max_fetch_depth">4</prop>
+<!-- 				<prop key="hibernate.hbm2ddl.auto">create</prop> -->
 				<!-- <prop key="hibernate.connection.release_mode">after_statement</prop> -->
 				<prop key="hibernate.cache.use_second_level_cache">true</prop>
 				<prop key="hibernate.cache.use_query_cache">true</prop>
@@ -95,4 +90,5 @@
 		class="org.springframework.orm.hibernate4.HibernateTransactionManager">
 		<property name="sessionFactory" ref="sessionFactory" />
 	</bean>
-</beans>
+	<bean id="generate" class="eu.cloudscale.showcase.generate.GenerateHibernate" />
+</beans>
\ No newline at end of file
diff --git a/application/src/main/resources/mongodb.xml b/application/src/main/resources/mongodb.xml
index deb185c..88e1e43 100644
--- a/application/src/main/resources/mongodb.xml
+++ b/application/src/main/resources/mongodb.xml
@@ -12,18 +12,18 @@
 
 	<!-- More information: http://static.springsource.org/spring-data/data-mongodb/docs/current/reference/html/mongo.core.html -->
 	<context:property-placeholder
-		location="classpath:database/database.aws.mongodb.properties" />
+		location="classpath:database/database.mongodb.properties" />
 	
 	<context:component-scan base-package="eu.cloudscale.showcase.db.dao.mongo.impl" />
 	
 	<mongo:mongo host="${mongodb.host}" port="${mongodb.port}" >
-		<mongo:options connections-per-host="100"
-                   threads-allowed-to-block-for-connection-multiplier="50"
-                   connect-timeout="1000"
-                   max-wait-time="2000"
-                   auto-connect-retry="true"
-                   socket-keep-alive="true"
-                   socket-timeout="2000"/>
+		<mongo:options connections-per-host="${connection_pool_size}"
+	                   threads-allowed-to-block-for-connection-multiplier="50"
+	                   connect-timeout="1000"
+	                   max-wait-time="2000"
+	                   auto-connect-retry="true"
+	                   socket-keep-alive="true"
+	                   socket-timeout="2000"/>
 	</mongo:mongo>
 
 	<mongo:db-factory host="${mongodb.host}" port="${mongodb.port}"
@@ -31,8 +31,8 @@
 
 	<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
 		<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
-		
 	</bean>
 	<bean id="service" class="eu.cloudscale.showcase.db.services.MongoService">
 	</bean>
+	<bean id="generate" class="eu.cloudscale.showcase.generate.GenerateMongo"/>	
 </beans>
\ No newline at end of file
diff --git a/application/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml b/application/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
index 7e780e1..5ac70f4 100644
--- a/application/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
+++ b/application/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans:beans xmlns="http://www.springframework.org/schema/mvc"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xmlns:beans="http://www.springframework.org/schema/beans"
 	xmlns:context="http://www.springframework.org/schema/context"
 	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
 		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
@@ -27,11 +28,6 @@
 
 	<beans:bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine">
 		<beans:property name="templateResolver" ref="templateResolver" />
-		<beans:property name="additionalDialects">
-			<beans:set>
-				<beans:bean class="nz.net.ultraq.thymeleaf.LayoutDialect" />
-			</beans:set>
-		</beans:property>
 	</beans:bean>
 
 	<beans:bean class="org.thymeleaf.spring3.view.ThymeleafViewResolver">
diff --git a/application/src/main/webapp/WEB-INF/views/best-sellers.html b/application/src/main/webapp/WEB-INF/views/best-sellers.html
index 09896ec..cb7f720 100644
--- a/application/src/main/webapp/WEB-INF/views/best-sellers.html
+++ b/application/src/main/webapp/WEB-INF/views/best-sellers.html
@@ -1,12 +1,74 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>Best sellers</title>
-  </head>
+		xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>Best sellers</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
+    <style type="text/css">
+        body {
+          padding-top: 20px;
+          padding-bottom: 40px;
+        }
+        
+        /* Custom container */
+        .container-narrow {
+          margin: 0 auto;
+          max-width: 700px;
+        }
+        .container-narrow > hr {
+          margin: 30px 0;
+        }
+        
+        /* Main marketing message and sign up button */
+        .jumbotron {
+          margin: 60px 0;
+          text-align: center;
+        }
+        .jumbotron h1 {
+          font-size: 72px;
+          line-height: 1;
+        }
+        .jumbotron .btn {
+          font-size: 21px;
+          padding: 14px 24px;
+        }
+        
+        /* Supporting marketing content */
+        .marketing {
+          margin: 60px 0;
+        }
+        .marketing p + h4 {
+          margin-top: 28px;
+        }
+        .promotional{
+        	margin: auto;
+        	width: 550px;
+        }
+        .promotional .pull-left{
+        	padding-right: 10px;
+        }
+        .left-column table td, 
+        .right-column table td{
+        	width: 150px;
+        	text-align: center;
+        }
+    </style>
+</head>
 <body>
-<div layout:fragment="content">
+<div class="container-narrow">
+
+	<div class="masthead">
+		<ul class="nav nav-pills pull-right">
+		  <li><a th:href="@{${searchUrl}}">Search</a></li>
+		  <li><a th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+		  <li><a th:href="@{${orderInquiryUrl}}">Order list</a></li>
+		</ul>
+		<h3 class="muted"><a href="/" th:href="@{${homeUrl}}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
+	</div>
+	
+	<hr />
 	
 	<div class="jumbotron">
 		<h1>TPC Web Commerce Benchmark (TPC-W)</h1>
@@ -14,7 +76,7 @@
 	<div class="promotional">
 		<div class="pull-left" th:each="item : ${promotional}">
 			<a th:href="@{'/product-detail?I_ID=' + ${item.IId} + '' + ${productUrl}}">
-				<img th:src="@{${imgResourceUrl}} + '/' + ${item.IThumbnail}" src="" width="100" height="100" />
+				<img th:src="@{/resources/img/} + ${item.IThumbnail}" src="" width="100" height="100" />
 			</a>
 		</div>
 		<div class="clearfix"></div>
diff --git a/application/src/main/webapp/WEB-INF/views/buy.html b/application/src/main/webapp/WEB-INF/views/buy.html
index 9c7bf4d..10f4b22 100644
--- a/application/src/main/webapp/WEB-INF/views/buy.html
+++ b/application/src/main/webapp/WEB-INF/views/buy.html
@@ -1,18 +1,107 @@
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>Buy</title>
-  </head>
+	xmlns:th="http://www.thymeleaf.org">
+<head>
+<title>Customer registration</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="stylesheet" href=""
+	th:href="@{/resources/css/bootstrap.min.css}" />
+<link rel="stylesheet" href=""
+	th:href="@{/resources/css/bootstrap-responsive.min.css}" />
+<style type="text/css">
+body {
+	padding-top: 20px;
+	padding-bottom: 40px;
+}
+
+/* Custom container */
+.container-narrow {
+	margin: 0 auto;
+	max-width: 700px;
+}
+
+.container-narrow>hr {
+	margin: 30px 0;
+}
+
+/* Main marketing message and sign up button */
+.jumbotron {
+	margin: 60px 0;
+	text-align: center;
+}
+
+.jumbotron h1 {
+	font-size: 72px;
+	line-height: 1;
+}
+
+.jumbotron .btn {
+	font-size: 21px;
+	padding: 14px 24px;
+}
+
+/* Supporting marketing content */
+.marketing {
+	margin: 60px 0;
+}
+
+.marketing p+h4 {
+	margin-top: 28px;
+}
+
+.promotional {
+	margin: auto;
+	width: 550px;
+}
+
+.promotional .pull-left {
+	padding-right: 10px;
+}
+
+.left-column table td,.right-column table td {
+	width: 150px;
+	text-align: center;
+}
+
+.myLabel {
+	width: 150px;
+	font-weight: bold;
+	text-align: right;
+}
+
+.content {
+	margin-left: 10px;
+}
+
+.payment .myLabel {
+	width: 250px;
+}
+</style>
+</head>
 <body>
-<div layout:fragment="content">
 	<div class="container-narrow">
 		<div th:if="${!errors.isEmpty()}" class="alert alert-error">
 			<div th:each="error : ${errors}" th:text="${error}"></div>
 		</div>
 		<div th:unless="${!errors.isEmpty()}">
 			<form th:action="@{/buy-confirm(C_ID=${customer.CId})}" method="get">
+
+				<div class="masthead">
+					<ul class="nav nav-pills pull-right">
+						<li><a href="#" th:href="@{${searchUrl}}">Search</a></li>
+						<li><a href="#" th:href="@{${shoppingCartUrl}}">Shopping
+								cart</a></li>
+						<li><a href="#" th:href="@{${orderInquiryUrl}}">Order
+								list</a></li>
+					</ul>
+					<h3 class="muted">
+						<a href="/" th:href="@{${homeUrl}}"><img
+							th:src="@{/resources/img/logo-CloudScale.png}" /></a>
+					</h3>
+				</div>
+
+				<hr />
+
 				<div class="billing-info">
 					<h2>Billing information:</h2>
 					<table>
@@ -108,7 +197,7 @@
 							</tr>
 						</thead>
 						<tbody>
-							<tr th:if="${cart != null and cart.shoppingCartLines != null}" th:each="line, i : ${cart.shoppingCartLines}">
+							<tr th:each="line, i : ${cart.shoppingCartLines}">
 								<td th:text="${line.sclQty}"></td>
 								<td>Title: <i th:text="${line.item.ITitle}"></i> - Backing:
 									<span th:text="${line.item.IBacking}"></span><br /> SRP. $<span
@@ -183,6 +272,5 @@
 			</form>
 		</div>
 	</div>
-</div>
 </body>
-</html>
+</html>
\ No newline at end of file
diff --git a/application/src/main/webapp/WEB-INF/views/buy-confirm.html b/application/src/main/webapp/WEB-INF/views/buy-confirm.html
index 680b1d3..e4c430a 100644
--- a/application/src/main/webapp/WEB-INF/views/buy-confirm.html
+++ b/application/src/main/webapp/WEB-INF/views/buy-confirm.html
@@ -1,12 +1,85 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>Buy confirm</title>
-  </head>
+		xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>Customer registration</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
+    <style type="text/css">
+        body {
+          padding-top: 20px;
+          padding-bottom: 40px;
+        }
+        
+        /* Custom container */
+        .container-narrow {
+          margin: 0 auto;
+          max-width: 700px;
+        }
+        .container-narrow > hr {
+          margin: 30px 0;
+        }
+        
+        /* Main marketing message and sign up button */
+        .jumbotron {
+          margin: 60px 0;
+          text-align: center;
+        }
+        .jumbotron h1 {
+          font-size: 72px;
+          line-height: 1;
+        }
+        .jumbotron .btn {
+          font-size: 21px;
+          padding: 14px 24px;
+        }
+        
+        /* Supporting marketing content */
+        .marketing {
+          margin: 60px 0;
+        }
+        .marketing p + h4 {
+          margin-top: 28px;
+        }
+        .promotional{
+        	margin: auto;
+        	width: 550px;
+        }
+        .promotional .pull-left{
+        	padding-right: 10px;
+        }
+        .left-column table td, 
+        .right-column table td{
+        	width: 150px;
+        	text-align: center;
+        }
+        .myLabel{
+        	width: 150px;
+        	font-weight: bold;
+        	text-align: right;
+        }
+        .content{
+        	margin-left: 10px;
+        }
+        
+        .payment .myLabel{
+        	width: 250px;
+        }
+    </style>
+</head>
 <body>
-<div layout:fragment="content">
+<div class="container-narrow">
+	<div class="masthead">
+		<ul class="nav nav-pills pull-right">
+		  <li><a href="#" th:href="@{${searchUrl}}">Search</a></li>
+		  <li><a href="#" th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+		  <li><a href="#" th:href="@{${orderInquiryUrl}}">Order list</a></li>
+		</ul>
+		<h3 class="muted"><a href="/" th:href="@{${homeUrl}}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
+	</div>
+	
+	<hr />
 	<div th:if="${!errors.isEmpty()}" class="alert alert-error">
 		<div th:each="error : ${errors}" th:text="${error}">
 		</div>
diff --git a/application/src/main/webapp/WEB-INF/views/customer-registration.html b/application/src/main/webapp/WEB-INF/views/customer-registration.html
index d15b5ee..752c2be 100644
--- a/application/src/main/webapp/WEB-INF/views/customer-registration.html
+++ b/application/src/main/webapp/WEB-INF/views/customer-registration.html
@@ -1,12 +1,74 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>Customer registration</title>
-  </head>
+		xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>Customer registration</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
+    <style type="text/css">
+        body {
+          padding-top: 20px;
+          padding-bottom: 40px;
+        }
+        
+        /* Custom container */
+        .container-narrow {
+          margin: 0 auto;
+          max-width: 700px;
+        }
+        .container-narrow > hr {
+          margin: 30px 0;
+        }
+        
+        /* Main marketing message and sign up button */
+        .jumbotron {
+          margin: 60px 0;
+          text-align: center;
+        }
+        .jumbotron h1 {
+          font-size: 72px;
+          line-height: 1;
+        }
+        .jumbotron .btn {
+          font-size: 21px;
+          padding: 14px 24px;
+        }
+        
+        /* Supporting marketing content */
+        .marketing {
+          margin: 60px 0;
+        }
+        .marketing p + h4 {
+          margin-top: 28px;
+        }
+        .promotional{
+        	margin: auto;
+        	width: 550px;
+        }
+        .promotional .pull-left{
+        	padding-right: 10px;
+        }
+        .left-column table td, 
+        .right-column table td{
+        	width: 150px;
+        	text-align: center;
+        }
+    </style>
+</head>
 <body>
-<div layout:fragment="content">
+<div class="container-narrow">
+
+	<div class="masthead">
+		<ul class="nav nav-pills pull-right">
+		  <li><a href="#" th:href="@{${searchUrl}}">Search</a></li>
+		  <li><a href="#" th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+		  <li><a href="#" th:href="@{${orderInquiryUrl}}">Order list</a></li>
+		</ul>
+		<h3 class="muted"><a href="/" th:href="@{${homeUrl}}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
+	</div>
+	
+	<hr />
 	
 	<h2 align="center">Customer registration</h2>
 	<form th:action="@{'/buy;jsessionid=' + ${sessionId}}" method="get">
diff --git a/application/src/main/webapp/WEB-INF/views/home.html b/application/src/main/webapp/WEB-INF/views/home.html
index 607ae5b..4bbb682 100644
--- a/application/src/main/webapp/WEB-INF/views/home.html
+++ b/application/src/main/webapp/WEB-INF/views/home.html
@@ -1,12 +1,80 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>TPC-W</title>
-  </head>
+		xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>TPC-W</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
+    <style type="text/css">
+        body {
+          padding-top: 20px;
+          padding-bottom: 40px;
+        }
+        
+        /* Custom container */
+        .container-narrow {
+          margin: 0 auto;
+          max-width: 700px;
+        }
+        .container-narrow > hr {
+          margin: 30px 0;
+        }
+        
+        /* Main marketing message and sign up button */
+        .jumbotron {
+          margin: 60px 0;
+          text-align: center;
+        }
+        .jumbotron h1 {
+          font-size: 72px;
+          line-height: 1;
+        }
+        .jumbotron .btn {
+          font-size: 21px;
+          padding: 14px 24px;
+        }
+        
+        /* Supporting marketing content */
+        .marketing {
+          margin: 60px 0;
+        }
+        .marketing p + h4 {
+          margin-top: 28px;
+        }
+        .promotional{
+        	margin: auto;
+        	width: 550px;
+        }
+        .promotional .pull-left{
+        	padding-right: 10px;
+        }
+        .left-column table td, 
+        .right-column table td{
+        	width: 150px;
+        	text-align: center;
+        }
+        
+        .footer{
+        	padding: 6px;
+        	text-align: center;
+        }
+    </style>
+</head>
 <body>
-<div layout:fragment="content">
+<div class="container-narrow">
+
+	<div class="masthead">
+		<ul class="nav nav-pills pull-right">
+		  <li><a th:href="@{${searchUrl}}">Search</a></li>
+		  <li><a th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+		  <li><a th:href="@{${orderInquiryUrl}}">Order list</a></li>
+		</ul>
+		<h3 class="muted"><a href="/" th:href="@{/}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
+	</div>
+	
+	<hr />
+	
 	<div class="jumbotron">
 		<h1>TPC Web Commerce Benchmark (TPC-W)</h1>
 	</div>
@@ -15,7 +83,7 @@
 	<div class="promotional">
 		<div class="pull-left" th:each="item : ${promotional}">
 			<a th:href="@{'/product-detail?I_ID=' + ${item.IId} + '' + ${productUrl}}">
-				<img th:src="@{ ${imgResourceUrl} + '/' + ${item.IThumbnail}}" src="" width="100" height="100" />
+				<img th:src="@{'/resources/img/' + ${item.IThumbnail}}" src="" width="100" height="100" />
 			</a>
 		</div>
 		<div class="clearfix"></div>
@@ -61,7 +129,9 @@
 			<div class="clearfix"></div>
 		</div>		
 	</div>
+	<div class="footer">
+		You're using <span th:text="${databaseDriverName}"></span>
+	</div>
 </div>
-
 </body>
 </html>
diff --git a/application/src/main/webapp/WEB-INF/views/new-products.html b/application/src/main/webapp/WEB-INF/views/new-products.html
index cad7890..edd9f0a 100644
--- a/application/src/main/webapp/WEB-INF/views/new-products.html
+++ b/application/src/main/webapp/WEB-INF/views/new-products.html
@@ -1,12 +1,74 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>New products</title>
-  </head>
+		xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>New products</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
+    <style type="text/css">
+        body {
+          padding-top: 20px;
+          padding-bottom: 40px;
+        }
+        
+        /* Custom container */
+        .container-narrow {
+          margin: 0 auto;
+          max-width: 700px;
+        }
+        .container-narrow > hr {
+          margin: 30px 0;
+        }
+        
+        /* Main marketing message and sign up button */
+        .jumbotron {
+          margin: 60px 0;
+          text-align: center;
+        }
+        .jumbotron h1 {
+          font-size: 72px;
+          line-height: 1;
+        }
+        .jumbotron .btn {
+          font-size: 21px;
+          padding: 14px 24px;
+        }
+        
+        /* Supporting marketing content */
+        .marketing {
+          margin: 60px 0;
+        }
+        .marketing p + h4 {
+          margin-top: 28px;
+        }
+        .promotional{
+        	margin: auto;
+        	width: 550px;
+        }
+        .promotional .pull-left{
+        	padding-right: 10px;
+        }
+        .left-column table td, 
+        .right-column table td{
+        	width: 150px;
+        	text-align: center;
+        }
+    </style>
+</head>
 <body>
-<div layout:fragment="content">
+<div class="container-narrow">
+
+	<div class="masthead">
+		<ul class="nav nav-pills pull-right">
+		  <li><a th:href="@{${searchUrl}}">Search</a></li>
+		  <li><a th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+		  <li><a th:href="@{${orderInquiryUrl}}">Order list</a></li>
+		</ul>
+		<h3 class="muted"><a href="/" th:href="@{${homeUrl}}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
+	</div>
+	
+	<hr />
 	
 	<div class="jumbotron">
 		<h1>TPC Web Commerce Benchmark (TPC-W)</h1>
@@ -14,7 +76,7 @@
 	<div class="promotional">
 		<div class="pull-left" th:each="item : ${promotional}">
 			<a th:href="@{'/product-detail?I_ID=' + ${item.IId} + '' + ${productUrl}}">
-				<img th:src="@{${imgResourceUrl}} + '/' + ${item.IThumbnail}" src="" width="100" height="100" />
+				<img th:src="@{/resources/img/} + ${item.IThumbnail}" src="" width="100" height="100" />
 			</a>
 		</div>
 		<div class="clearfix"></div>
diff --git a/application/src/main/webapp/WEB-INF/views/order-display.html b/application/src/main/webapp/WEB-INF/views/order-display.html
index 816aa1b..0167257 100644
--- a/application/src/main/webapp/WEB-INF/views/order-display.html
+++ b/application/src/main/webapp/WEB-INF/views/order-display.html
@@ -1,16 +1,78 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>Order display</title>
-  </head>
+		xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>Order display</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
+    <style type="text/css">
+        body {
+          padding-top: 20px;
+          padding-bottom: 40px;
+        }
+        
+        /* Custom container */
+        .container-narrow {
+          margin: 0 auto;
+          max-width: 700px;
+        }
+        .container-narrow > hr {
+          margin: 30px 0;
+        }
+        
+        /* Main marketing message and sign up button */
+        .jumbotron {
+          margin: 60px 0;
+          text-align: center;
+        }
+        .jumbotron h1 {
+          font-size: 72px;
+          line-height: 1;
+        }
+        .jumbotron .btn {
+          font-size: 21px;
+          padding: 14px 24px;
+        }
+        
+        /* Supporting marketing content */
+        .marketing {
+          margin: 60px 0;
+        }
+        .marketing p + h4 {
+          margin-top: 28px;
+        }
+        .promotional{
+        	margin: auto;
+        	width: 550px;
+        }
+        .promotional .pull-left{
+        	padding-right: 10px;
+        }
+        .left-column table td, 
+        .right-column table td{
+        	width: 150px;
+        	text-align: center;
+        }
+    </style>
+</head>
 <body>
-<div layout:fragment="content">
-	<div class="alert alert-error" th:if="${!errors.isEmpty()}" th:each="erro : ${errors}">
-		<div th:text="${err}"></div>		
+<div class="container-narrow">
+
+	<div class="masthead">
+		<ul class="nav nav-pills pull-right">
+		  <li><a th:href="@{${searchUrl}}">Search</a></li>
+		  <li><a th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+		  <li><a th:href="@{${orderInquiryUrl}}">Order list</a></li>
+		</ul>
+		<h3 class="muted"><a href="/" th:href="@{/}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
 	</div>
-	<div th:unless="${!errors.isEmpty()}">
+	
+	<hr />
+	<div th:if="${errors}" class="alert alert-error" th:each="erro : ${errors}">
+		<div th:text="${erro}"></div>		
+	</div>
+	<div th:unless="${errors}">
 		<div th:if="${order}">
 			<p>
 				<strong>Order ID:</strong><span th:text="${order.OId}"></span>
diff --git a/application/src/main/webapp/WEB-INF/views/order-inquiry.html b/application/src/main/webapp/WEB-INF/views/order-inquiry.html
index 92c91cf..d31e760 100644
--- a/application/src/main/webapp/WEB-INF/views/order-inquiry.html
+++ b/application/src/main/webapp/WEB-INF/views/order-inquiry.html
@@ -1,12 +1,75 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>Order inquiry</title>
-  </head>
+		xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>Order inquiry</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
+    <style type="text/css">
+        body {
+          padding-top: 20px;
+          padding-bottom: 40px;
+        }
+        
+        /* Custom container */
+        .container-narrow {
+          margin: 0 auto;
+          max-width: 700px;
+        }
+        .container-narrow > hr {
+          margin: 30px 0;
+        }
+        
+        /* Main marketing message and sign up button */
+        .jumbotron {
+          margin: 60px 0;
+          text-align: center;
+        }
+        .jumbotron h1 {
+          font-size: 72px;
+          line-height: 1;
+        }
+        .jumbotron .btn {
+          font-size: 21px;
+          padding: 14px 24px;
+        }
+        
+        /* Supporting marketing content */
+        .marketing {
+          margin: 60px 0;
+        }
+        .marketing p + h4 {
+          margin-top: 28px;
+        }
+        .promotional{
+        	margin: auto;
+        	width: 550px;
+        }
+        .promotional .pull-left{
+        	padding-right: 10px;
+        }
+        .left-column table td, 
+        .right-column table td{
+        	width: 150px;
+        	text-align: center;
+        }
+    </style>
+</head>
 <body>
-<div layout:fragment="content">	
+<div class="container-narrow">
+
+	<div class="masthead">
+		<ul class="nav nav-pills pull-right">
+		  <li><a th:href="@{${searchUrl}}">Search</a></li>
+		  <li><a th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+		  <li><a th:href="@{${orderInquiryUrl}}">Order list</a></li>
+		</ul>
+		<h3 class="muted"><a href="/" th:href="@{/}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
+	</div>
+	
+	<hr />
+	
 	<div>
 		<form th:action="@{/order-display}" method="get" >
 			<fieldset>
diff --git a/application/src/main/webapp/WEB-INF/views/product_detail.html b/application/src/main/webapp/WEB-INF/views/product_detail.html
index dfc38fb..cba1f39 100644
--- a/application/src/main/webapp/WEB-INF/views/product_detail.html
+++ b/application/src/main/webapp/WEB-INF/views/product_detail.html
@@ -1,12 +1,74 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>Product detail page</title>
-  </head>
+	xmlns:th="http://www.thymeleaf.org">
+<head>
+<title>Product detail page</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="stylesheet" href=""
+	th:href="@{/resources/css/bootstrap.min.css}" />
+<link rel="stylesheet" href=""
+	th:href="@{/resources/css/bootstrap-responsive.min.css}" />
+<style type="text/css">
+body {
+	padding-top: 20px;
+	padding-bottom: 40px;
+}
+
+/* Custom container */
+.container-narrow {
+	margin: 0 auto;
+	max-width: 700px;
+}
+
+.container-narrow>hr {
+	margin: 30px 0;
+}
+
+/* Main marketing message and sign up button */
+.jumbotron {
+	margin: 60px 0;
+	text-align: center;
+}
+
+.jumbotron h1 {
+	font-size: 72px;
+	line-height: 1;
+}
+
+.jumbotron .btn {
+	font-size: 21px;
+	padding: 14px 24px;
+}
+
+/* Supporting marketing content */
+.marketing {
+	margin: 60px 0;
+}
+
+.marketing p+h4 {
+	margin-top: 28px;
+}
+</style>
+</head>
 <body>
-<div layout:fragment="content">
+	<div class="container-narrow">
+
+		<div class="masthead">
+			<ul class="nav nav-pills pull-right">
+				<li><a th:href="@{${searchUrl}}">Search</a></li>
+				<li><a th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+				<li><a th:href="@{${orderInquiryUrl}}">Order list</a></li>
+			</ul>
+			<h3 class="muted"><a href="/" th:href="@{/}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
+		</div>
+
+		<hr />
+
+		<div>
+			<h2>Product detail page</h2>
+		</div>
+
+		<hr />
 
 		<div class="row-fluid marketing">
 			<dl class="dl-horizontal">
diff --git a/application/src/main/webapp/WEB-INF/views/search.html b/application/src/main/webapp/WEB-INF/views/search.html
index b412687..ebcfacf 100644
--- a/application/src/main/webapp/WEB-INF/views/search.html
+++ b/application/src/main/webapp/WEB-INF/views/search.html
@@ -1,12 +1,77 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>Search</title>
-  </head>
+		xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>TPC-W</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
+    <style type="text/css">
+        body {
+          padding-top: 20px;
+          padding-bottom: 40px;
+        }
+        
+        /* Custom container */
+        .container-narrow {
+          margin: 0 auto;
+          max-width: 700px;
+        }
+        .container-narrow > hr {
+          margin: 30px 0;
+        }
+        
+        /* Main marketing message and sign up button */
+        .jumbotron {
+          margin: 60px 0;
+          text-align: center;
+        }
+        .jumbotron h1 {
+          font-size: 72px;
+          line-height: 1;
+        }
+        .jumbotron .btn {
+          font-size: 21px;
+          padding: 14px 24px;
+        }
+        
+        /* Supporting marketing content */
+        .marketing {
+          margin: 60px 0;
+        }
+        .marketing p + h4 {
+          margin-top: 28px;
+        }
+        .promotional{
+        	margin: auto;
+        	width: 550px;
+        }
+        .promotional .pull-left{
+        	padding-right: 10px;
+        }
+        .left-column table td, 
+        .right-column table td{
+        	width: 150px;
+        	text-align: center;
+        }
+        tr, td{
+        	text-align: center;
+        }
+    </style>
+</head>
 <body>
-<div layout:fragment="content">
+<div class="container-narrow">
+
+	<div class="masthead">
+		<ul class="nav nav-pills pull-right">
+		  <li><a th:href="@{${searchUrl}}">Search</a></li>
+		  <li><a th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+		  <li><a th:href="@{${orderInquiryUrl}}">Order list</a></li>
+		</ul>
+		<h3 class="muted"><a href="/" th:href="@{/}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
+	</div>
+	
+	<hr />
 	
 	<div class="jumbotron">
 		<h1>TPC Web Commerce Benchmark (TPC-W)</h1>
@@ -14,8 +79,7 @@
 	<div class="promotional">
 		<div class="pull-left" th:each="item : ${promotional}">
 			<a th:href="@{'/product-detail?I_ID=' + ${item.IId} + '' + ${productUrl}}">
-				<img th:src="@{ ${imgResourceUrl} + '/' + ${item.IThumbnail}" src="" width="100" height="100" />
-			
+				<img th:src="@{/resources/img/} + ${item.IThumbnail}" src="" width="100" height="100" />
 			</a>
 		</div>
 		<div class="clearfix"></div>
diff --git a/application/src/main/webapp/WEB-INF/views/shopping-cart.html b/application/src/main/webapp/WEB-INF/views/shopping-cart.html
index 751cae9..4722df1 100644
--- a/application/src/main/webapp/WEB-INF/views/shopping-cart.html
+++ b/application/src/main/webapp/WEB-INF/views/shopping-cart.html
@@ -1,12 +1,74 @@
-<!DOCTYPE html>
+<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
-  layout:decorator="/templates/layout">
-  <head>
-  	<title>Shopping cart</title>
-  </head>
+		xmlns:th="http://www.thymeleaf.org">
+<head>
+    <title>Shopping cart</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
+    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
+    <style type="text/css">
+        body {
+          padding-top: 20px;
+          padding-bottom: 40px;
+        }
+        
+        /* Custom container */
+        .container-narrow {
+          margin: 0 auto;
+          max-width: 700px;
+        }
+        .container-narrow > hr {
+          margin: 30px 0;
+        }
+        
+        /* Main marketing message and sign up button */
+        .jumbotron {
+          margin: 60px 0;
+          text-align: center;
+        }
+        .jumbotron h1 {
+          font-size: 72px;
+          line-height: 1;
+        }
+        .jumbotron .btn {
+          font-size: 21px;
+          padding: 14px 24px;
+        }
+        
+        /* Supporting marketing content */
+        .marketing {
+          margin: 60px 0;
+        }
+        .marketing p + h4 {
+          margin-top: 28px;
+        }
+        .promotional{
+        	margin: auto;
+        	width: 550px;
+        }
+        .promotional .pull-left{
+        	padding-right: 10px;
+        }
+        .left-column table td, 
+        .right-column table td{
+        	width: 150px;
+        	text-align: center;
+        }
+    </style>
+</head>
 <body>
-<div layout:fragment="content">
+<div class="container-narrow">
+
+	<div class="masthead">
+		<ul class="nav nav-pills pull-right">
+		  <li><a th:href="@{${searchUrl}}">Search</a></li>
+		  <li><a th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
+		  <li><a th:href="@{${orderInquiryUrl}}">Order list</a></li>
+		</ul>
+		<h3 class="muted"><a href="/" th:href="@{${homeUrl}}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
+	</div>
+	
+	<hr />
 	<div th:if="${errors.isEmpty()}">
 		<div class="jumbotron">
 			<h1>TPC Web Commerce Benchmark (TPC-W)</h1>
@@ -14,7 +76,7 @@
 		<div class="promotional">
 			<div class="pull-left" th:each="item : ${promotional}">
 				<a th:href="@{'/product-detail?I_ID=' + ${item.IId}}">
-					<img th:src="@{ ${imgResourceUrl} + '/' + ${item.IThumbnail}" src="" width="100" height="100" />
+					<img th:src="@{/resources/img/} + ${item.IThumbnail}" src="" width="100" height="100" />
 				</a>
 			</div>
 			<div class="clearfix"></div>
diff --git a/application/src/main/webapp/WEB-INF/web.xml b/application/src/main/webapp/WEB-INF/web.xml
index 1636ebf..3901935 100644
--- a/application/src/main/webapp/WEB-INF/web.xml
+++ b/application/src/main/webapp/WEB-INF/web.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
   <context-param>
     <param-name>contextConfigLocation</param-name>
     <param-value>/WEB-INF/spring/root-context.xml</param-value>