From bccc8fc690c49a8791b2e0b5079c618edb31ad4d Mon Sep 17 00:00:00 2001 From: Eugen Date: Fri, 17 May 2013 12:12:34 +0300 Subject: [PATCH] minor persistence work --- spring-hibernate4/.classpath | 7 +- .../org.eclipse.wst.common.component | 1 + spring-hibernate4/pom.xml | 267 +++++++++--------- .../persistence/service/FooService.java | 2 + .../FooServicePersistenceIntegrationTest.java | 13 + 5 files changed, 159 insertions(+), 131 deletions(-) create mode 100644 spring-hibernate4/src/test/java/org/baeldung/spring/persistence/service/FooServicePersistenceIntegrationTest.java diff --git a/spring-hibernate4/.classpath b/spring-hibernate4/.classpath index 593395a46e..10115292f4 100644 --- a/spring-hibernate4/.classpath +++ b/spring-hibernate4/.classpath @@ -16,6 +16,12 @@ + + + + + + @@ -24,7 +30,6 @@ - diff --git a/spring-hibernate4/.settings/org.eclipse.wst.common.component b/spring-hibernate4/.settings/org.eclipse.wst.common.component index 6192602079..59f6da9f95 100644 --- a/spring-hibernate4/.settings/org.eclipse.wst.common.component +++ b/spring-hibernate4/.settings/org.eclipse.wst.common.component @@ -4,6 +4,7 @@ + diff --git a/spring-hibernate4/pom.xml b/spring-hibernate4/pom.xml index c7171e0acd..61129e1a47 100644 --- a/spring-hibernate4/pom.xml +++ b/spring-hibernate4/pom.xml @@ -1,157 +1,164 @@ - - 4.0.0 - org.baeldung - spring-hibernate4 - 0.1-SNAPSHOT + + 4.0.0 + org.baeldung + spring-hibernate4 + 0.1-SNAPSHOT - spring-hibernate4 - war + spring-hibernate4 + war - + - + - - org.springframework - spring-web - ${org.springframework.version} - - - org.springframework - spring-orm - ${org.springframework.version} - - - org.springframework - spring-context - ${org.springframework.version} - + + org.springframework + spring-web + ${org.springframework.version} + + + org.springframework + spring-orm + ${org.springframework.version} + + + org.springframework + spring-context + ${org.springframework.version} + - + - - org.hibernate - hibernate-core - 4.2.1.Final - - - org.javassist - javassist - 3.17.1-GA - - - mysql - mysql-connector-java - 5.1.25 - runtime - + + org.hibernate + hibernate-core + 4.2.1.Final + + + org.javassist + javassist + 3.17.1-GA + + + mysql + mysql-connector-java + 5.1.25 + runtime + - + - - com.google.guava - guava - 14.0.1 - + + com.google.guava + guava + 14.0.1 + - + + + org.springframework + spring-test + ${org.springframework.version} + test + - - junit - junit-dep - ${junit.version} - test - + + junit + junit-dep + ${junit.version} + test + - - org.hamcrest - hamcrest-core - ${org.hamcrest.version} - test - - - org.hamcrest - hamcrest-library - ${org.hamcrest.version} - test - + + org.hamcrest + hamcrest-core + ${org.hamcrest.version} + test + + + org.hamcrest + hamcrest-library + ${org.hamcrest.version} + test + - - org.mockito - mockito-core - ${mockito.version} - test - + + org.mockito + mockito-core + ${mockito.version} + test + - + - - spring-hibernate4 - - - src/main/resources - true - - + + spring-hibernate4 + + + src/main/resources + true + + - + - - org.apache.maven.plugins - maven-surefire-plugin - - - - - - - - - + + org.apache.maven.plugins + maven-surefire-plugin + + + + + + + + + - - org.codehaus.cargo - cargo-maven2-plugin - - true - - jetty8x - embedded - - - - - - - 8082 - - - - + + org.codehaus.cargo + cargo-maven2-plugin + + true + + jetty8x + embedded + + + + + + + 8082 + + + + - + - + - - - 3.2.2.RELEASE + + + 3.2.2.RELEASE - - 1.7.5 - 1.0.11 + + 1.7.5 + 1.0.11 - - 1.3 - 4.11 - 1.9.5 + + 1.3 + 4.11 + 1.9.5 - 4.2.4 - 4.2.4 + 4.2.4 + 4.2.4 - 1.8.0 - 1.8.9 + 1.8.0 + 1.8.9 - + \ No newline at end of file diff --git a/spring-hibernate4/src/main/java/org/baeldung/spring/persistence/service/FooService.java b/spring-hibernate4/src/main/java/org/baeldung/spring/persistence/service/FooService.java index cda31a0e86..896e2795ff 100644 --- a/spring-hibernate4/src/main/java/org/baeldung/spring/persistence/service/FooService.java +++ b/spring-hibernate4/src/main/java/org/baeldung/spring/persistence/service/FooService.java @@ -3,8 +3,10 @@ package org.baeldung.spring.persistence.service; import org.baeldung.spring.persistence.dao.IFooDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service +@Transactional public class FooService { @Autowired diff --git a/spring-hibernate4/src/test/java/org/baeldung/spring/persistence/service/FooServicePersistenceIntegrationTest.java b/spring-hibernate4/src/test/java/org/baeldung/spring/persistence/service/FooServicePersistenceIntegrationTest.java new file mode 100644 index 0000000000..5d23f5354c --- /dev/null +++ b/spring-hibernate4/src/test/java/org/baeldung/spring/persistence/service/FooServicePersistenceIntegrationTest.java @@ -0,0 +1,13 @@ +package org.baeldung.spring.persistence.service; + +import org.baeldung.spring.persistence.config.PersistenceConfig; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class FooServicePersistenceIntegrationTest { + // +}