Owner
s from the data store by last name, returning all owners whose last name starts
- * with the given name.
- *
+ * Retrieve {@link Owner}s from the data store by last name, returning all owners
+ * whose last name starts with the given name.
* @param lastName Value to search for
- * @return a Collection
of matching Owner
s (or an empty Collection
if none
+ * @return a Collection of matching {@link Owner}s (or an empty Collection if none
* found)
*/
- CollectionOwner
from the data store by id.
- *
+ * Retrieve an {@link Owner} from the data store by id.
* @param id the id to search for
- * @return the Owner
if found
- * @throws org.springframework.dao.DataRetrievalFailureException if not found
+ * @return the {@link Owner} if found
*/
- Owner findById(int id) throws DataAccessException;
-
+ @Query("SELECT owner FROM Owner owner left join fetch owner.pets WHERE owner.id =:id")
+ Owner findById(@Param("id") int id);
/**
- * Save an Owner
to the data store, either inserting or updating it.
- *
- * @param owner the Owner
to save
- * @see BaseEntity#isNew
+ * Save an {@link Owner} to the data store, either inserting or updating it.
+ * @param owner the {@link Owner} to save
*/
- void save(Owner owner) throws DataAccessException;
+ void save(Owner owner);
}
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java
index 1770e8555..58e73d7f6 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java
@@ -18,6 +18,8 @@ package org.springframework.samples.petclinic.repository;
import java.util.List;
import org.springframework.dao.DataAccessException;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.Repository;
import org.springframework.samples.petclinic.model.BaseEntity;
import org.springframework.samples.petclinic.model.Pet;
import org.springframework.samples.petclinic.model.PetType;
@@ -31,30 +33,27 @@ import org.springframework.samples.petclinic.model.PetType;
* @author Sam Brannen
* @author Michael Isvy
*/
-public interface PetRepository {
+public interface PetRepository extends RepositoryPetType
s from the data store.
- *
- * @return a Collection
of PetType
s
+ * Retrieve all {@link PetType}s from the data store.
+ * @return a Collection of {@link PetType}s.
*/
- ListPet
from the data store by id.
- *
+ * Retrieve a {@link Pet} from the data store by id.
* @param id the id to search for
- * @return the Pet
if found
- * @throws org.springframework.dao.DataRetrievalFailureException if not found
+ * @return the {@link Pet} if found
*/
- Pet findById(int id) throws DataAccessException;
+ Pet findById(int id);
/**
- * Save a Pet
to the data store, either inserting or updating it.
- *
- * @param pet the Pet
to save
- * @see BaseEntity#isNew
+ * Save a {@link Pet} to the data store, either inserting or updating it.
+ * @param pet the {@link Pet} to save
*/
- void save(Pet pet) throws DataAccessException;
+ void save(Pet pet);
}
+
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/VetRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/VetRepository.java
index 923c3c23d..aabdfd65d 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/VetRepository.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/VetRepository.java
@@ -18,6 +18,7 @@ package org.springframework.samples.petclinic.repository;
import java.util.Collection;
import org.springframework.dao.DataAccessException;
+import org.springframework.data.repository.Repository;
import org.springframework.samples.petclinic.model.Vet;
/**
@@ -29,7 +30,7 @@ import org.springframework.samples.petclinic.model.Vet;
* @author Sam Brannen
* @author Michael Isvy
*/
-public interface VetRepository {
+public interface VetRepository extends RepositoryVet
s from the data store.
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/VisitRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/VisitRepository.java
index 96b7a208c..e734f3275 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/VisitRepository.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/VisitRepository.java
@@ -18,6 +18,7 @@ package org.springframework.samples.petclinic.repository;
import java.util.List;
import org.springframework.dao.DataAccessException;
+import org.springframework.data.repository.Repository;
import org.springframework.samples.petclinic.model.BaseEntity;
import org.springframework.samples.petclinic.model.Visit;
@@ -30,7 +31,7 @@ import org.springframework.samples.petclinic.model.Visit;
* @author Sam Brannen
* @author Michael Isvy
*/
-public interface VisitRepository {
+public interface VisitRepository extends RepositoryVisit
to the data store, either inserting or updating it.
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java
deleted file mode 100644
index 45de1aee0..000000000
--- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright 2002-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.samples.petclinic.repository.jdbc;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.sql.DataSource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.DataAccessException;
-import org.springframework.dao.EmptyResultDataAccessException;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
-import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
-import org.springframework.orm.ObjectRetrievalFailureException;
-import org.springframework.samples.petclinic.model.Owner;
-import org.springframework.samples.petclinic.model.Pet;
-import org.springframework.samples.petclinic.model.PetType;
-import org.springframework.samples.petclinic.model.Visit;
-import org.springframework.samples.petclinic.repository.OwnerRepository;
-import org.springframework.samples.petclinic.util.EntityUtils;
-import org.springframework.stereotype.Repository;
-
-/**
- * A simple JDBC-based implementation of the {@link OwnerRepository} interface.
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Rob Harrop
- * @author Sam Brannen
- * @author Thomas Risberg
- * @author Mark Fisher
- */
-@Repository
-public class JdbcOwnerRepositoryImpl implements OwnerRepository {
-
- private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
-
- private SimpleJdbcInsert insertOwner;
-
- @Autowired
- public JdbcOwnerRepositoryImpl(DataSource dataSource, NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
-
- this.insertOwner = new SimpleJdbcInsert(dataSource)
- .withTableName("owners")
- .usingGeneratedKeyColumns("id");
-
- this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
-
- }
-
-
- /**
- * Loads {@link Owner Owners} from the data store by last name, returning all owners whose last name starts with
- * the given name; also loads the {@link Pet Pets} and {@link Visit Visits} for the corresponding owners, if not
- * already loaded.
- */
- @Override
- public Collectionid
; also loads the {@link Pet Pets} and {@link Visit Visits}
- * for the corresponding owner, if not already loaded.
- */
- @Override
- public Owner findById(int id) throws DataAccessException {
- Owner owner;
- try {
- MapThe mappings are defined in "orm.xml" located in the META-INF directory.
- *
- * @author Mike Keith
- * @author Rod Johnson
- * @author Sam Brannen
- * @author Michael Isvy
- * @since 22.4.2006
- */
-@Repository
-public class JpaVisitRepositoryImpl implements VisitRepository {
-
- @PersistenceContext
- private EntityManager em;
-
-
- @Override
- public void save(Visit visit) {
- if (visit.getId() == null) {
- this.em.persist(visit);
- } else {
- this.em.merge(visit);
- }
- }
-
-
- @Override
- @SuppressWarnings("unchecked")
- public List
- The Spring Data Binding framework, an internal library used by Spring Web Flow.
-Organisation
-
-Speakers
-
-
-
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
new file mode 100644
index 000000000..688ae2044
--- /dev/null
+++ b/src/main/resources/application.properties
@@ -0,0 +1,23 @@
+# Web
+spring.mvc.view.prefix: /WEB-INF/jsp/
+spring.mvc.view.suffix: .jsp
+
+
+# JPA
+spring.jpa.hibernate.ddl-auto: none
+#spring.jpa.database: HSQL
+#spring.jpa.show-sql: true
+#spring.datasource.driverClassName=org.hsqldb.jdbcDriver
+spring.datasource.schema: classpath*:db/hsqldb/initDB.sql
+spring.datasource.data: classpath*:db/hsqldb/populateDB.sql
+#spring.datasource.username: sa
+#spring.datasource.password:
+
+# Internationalization
+spring.messages.basename: messages/messages
+
+# Actuator / Management
+management.contextPath: /manage
+
+# Logging
+logging.level.org.springframework=INFO
diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt
new file mode 100644
index 000000000..6225d1208
--- /dev/null
+++ b/src/main/resources/banner.txt
@@ -0,0 +1,15 @@
+
+
+ |\ _,,,--,,_
+ /,`.-'`' ._ \-;;,_
+ _______ __|,4- ) )_ .;.(__`'-'__ ___ __ _ ___ _______
+ | | '---''(_/._)-'(_\_) | | | | | | | | |
+ | _ | ___|_ _| | | | | |_| | | | __ _ _
+ | |_| | |___ | | | | | | | | | | \ \ \ \
+ | ___| ___| | | | _| |___| | _ | | _| \ \ \ \
+ | | | |___ | | | |_| | | | | | | |_ ) ) ) )
+ |___| |_______| |___| |_______|_______|___|_| |__|___|_______| / / / /
+ ==================================================================/_/_/_/
+
+:: Built with Spring Boot :: ${spring-boot.version}
+
diff --git a/src/main/resources/cache/ehcache.xml b/src/main/resources/ehcache.xml
similarity index 100%
rename from src/main/resources/cache/ehcache.xml
rename to src/main/resources/ehcache.xml
diff --git a/src/main/resources/cache/ehcache.xsd b/src/main/resources/ehcache.xsd
similarity index 100%
rename from src/main/resources/cache/ehcache.xsd
rename to src/main/resources/ehcache.xsd
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
deleted file mode 100644
index 54bfd5f2d..000000000
--- a/src/main/resources/logback.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
Sergiu Bodiu
-
- Java Consultant at Bank of America
- Seasoned consultant experienced in large-scale e-commerce projects, passionate about
- providing innovative technology solutions to solve complex business problems, have extensive knowledge and
- experience delivering enterprise wide applications. He is skilled in software design, data modeling,
- stakeholder management, IT strategic planning, technical know-how and security. Able to design, implement,
- test and maintain software product components with strong focus on design elegance and software reuse.
-
-
-
-
-
-
-
-
Sergiu Bodiu
-
- Java Consultant at Bank of America
- Seasoned consultant experienced in large-scale e-commerce projects, passionate about
- providing innovative technology solutions to solve complex business problems, have extensive knowledge and
- experience delivering enterprise wide applications. He is skilled in software design, data modeling,
- stakeholder management, IT strategic planning, technical know-how and security. Able to design, implement,
- test and maintain software product components with strong focus on design elegance and software reuse.
-