From 015050f9288e84c0bfc82604e9ceebdab56cddce Mon Sep 17 00:00:00 2001 From: eugenp Date: Sat, 4 May 2013 22:44:39 +0300 Subject: [PATCH] persistence work --- spring-hibernate-dao/pom.xml | 236 +++++++++--------- .../persistence/config/PersistenceConfig.java | 10 +- .../src/main/webapp/WEB-INF/web.xml | 26 +- 3 files changed, 143 insertions(+), 129 deletions(-) diff --git a/spring-hibernate-dao/pom.xml b/spring-hibernate-dao/pom.xml index f72835845e..3eee877117 100644 --- a/spring-hibernate-dao/pom.xml +++ b/spring-hibernate-dao/pom.xml @@ -1,139 +1,151 @@ - 4.0.0 - org.baeldung - spring-hibernate-dao - 0.1-SNAPSHOT + 4.0.0 + org.baeldung + spring-hibernate-dao + 0.1-SNAPSHOT - spring-hibernate-dao - war + spring-hibernate-dao + war - + - + - - 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.hibernate + hibernate-core + 4.2.1.Final + + - + + com.google.guava + guava + 14.0.1 + - - junit - junit-dep - ${junit.version} - test - + - - org.hamcrest - hamcrest-core - ${org.hamcrest.version} - test - - - org.hamcrest - hamcrest-library - ${org.hamcrest.version} - test - + + junit + junit-dep + ${junit.version} + test + - - org.mockito - mockito-core - ${mockito.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 + - - spring-hibernate-dao - - - src/main/resources - true - - + - + + spring-hibernate-dao + + + src/main/resources + true + + - - org.apache.maven.plugins - maven-surefire-plugin - - - - - - - - - + - - org.codehaus.cargo - cargo-maven2-plugin - - true - - jetty8x - embedded - - - - - - - 8082 - - - - + + org.apache.maven.plugins + maven-surefire-plugin + + + + + + + + + - + + org.codehaus.cargo + cargo-maven2-plugin + + true + + jetty8x + embedded + + + + + + + 8082 + + + + - + - - - 3.2.2.RELEASE + - - 1.7.5 - 1.0.11 + + + 3.2.2.RELEASE - - 1.3 - 4.11 - 1.9.5 + + 1.7.5 + 1.0.11 - 4.2.4 - 4.2.4 + + 1.3 + 4.11 + 1.9.5 - 1.8.0 - 1.8.9 + 4.2.4 + 4.2.4 - + 1.8.0 + 1.8.9 + + \ No newline at end of file diff --git a/spring-hibernate-dao/src/main/java/org/baeldung/spring/persistence/config/PersistenceConfig.java b/spring-hibernate-dao/src/main/java/org/baeldung/spring/persistence/config/PersistenceConfig.java index 33833f364c..fa7138f742 100644 --- a/spring-hibernate-dao/src/main/java/org/baeldung/spring/persistence/config/PersistenceConfig.java +++ b/spring-hibernate-dao/src/main/java/org/baeldung/spring/persistence/config/PersistenceConfig.java @@ -15,6 +15,8 @@ import org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBea import org.springframework.orm.hibernate4.HibernateTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; +import com.google.common.base.Preconditions; + @Configuration @EnableTransactionManagement @ComponentScan({ "org.baeldung.spring.persistence.dao", "org.baeldung.spring.persistence.service" }) @@ -40,10 +42,10 @@ public class PersistenceConfig { @Bean public DataSource restDataSource() { final DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName")); - dataSource.setUrl(env.getProperty("jdbc.url")); - dataSource.setUsername(env.getProperty("jdbc.user")); - dataSource.setPassword(env.getProperty("jdbc.pass")); + dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); + dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); + dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); + dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); return dataSource; } diff --git a/spring-hibernate-dao/src/main/webapp/WEB-INF/web.xml b/spring-hibernate-dao/src/main/webapp/WEB-INF/web.xml index 7e3d3b3181..ebe53ec4c0 100644 --- a/spring-hibernate-dao/src/main/webapp/WEB-INF/web.xml +++ b/spring-hibernate-dao/src/main/webapp/WEB-INF/web.xml @@ -22,19 +22,19 @@ org.springframework.web.context.ContextLoaderListener - - - mvc - org.springframework.web.servlet.DispatcherServlet - 1 - - - mvc - / - + + + + + + + + + + - - index.html - + + + \ No newline at end of file