BaseEntity
. Used as
- * a base class for objects needing these properties.
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- */
-@MappedSuperclass
-public class NamedEntity extends BaseEntity {
-
- @Column(name = "name")
- private String name;
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return this.getName();
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/model/Person.java b/src/main/java/org/springframework/samples/petclinic/model/Person.java
deleted file mode 100644
index 15fabacc3..000000000
--- a/src/main/java/org/springframework/samples/petclinic/model/Person.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.model;
-
-import javax.persistence.Column;
-import javax.persistence.MappedSuperclass;
-import javax.validation.constraints.NotEmpty;
-
-/**
- * Simple JavaBean domain object representing an person.
- *
- * @author Ken Krebs
- */
-@MappedSuperclass
-public class Person extends BaseEntity {
-
- @Column(name = "first_name")
- @NotEmpty
- private String firstName;
-
- @Column(name = "last_name")
- @NotEmpty
- private String lastName;
-
- public String getFirstName() {
- return this.firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return this.lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/model/package-info.java b/src/main/java/org/springframework/samples/petclinic/model/package-info.java
deleted file mode 100644
index 37d6295e8..000000000
--- a/src/main/java/org/springframework/samples/petclinic/model/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.
- */
-
-/**
- * The classes in this package represent utilities used by the domain.
- */
-package org.springframework.samples.petclinic.model;
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java
index 61083bc8d..cf791235d 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java
+++ b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java
@@ -15,24 +15,18 @@
*/
package org.springframework.samples.petclinic.owner;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
-import org.springframework.beans.support.MutableSortDefinition;
-import org.springframework.beans.support.PropertyComparator;
import org.springframework.core.style.ToStringCreator;
-import org.springframework.samples.petclinic.model.Person;
+import org.springframework.data.annotation.Id;
+import org.springframework.data.couchbase.core.mapping.Document;
+import org.springframework.data.couchbase.core.mapping.id.GeneratedValue;
+import org.springframework.data.couchbase.core.mapping.id.GenerationStrategy;
+
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
/**
* Simple JavaBean domain object representing an owner.
@@ -42,25 +36,66 @@ import org.springframework.samples.petclinic.model.Person;
* @author Sam Brannen
* @author Michael Isvy
*/
-@Entity
-@Table(name = "owners")
-public class Owner extends Person {
- @Column(name = "address")
+@Document
+public class Owner {
+
+ @Id
+ @GeneratedValue(strategy = GenerationStrategy.UNIQUE)
+ private String id;
+
+ @NotEmpty
+ private String firstName;
+
+ @NotEmpty
+ private String lastName;
+
@NotEmpty
private String address;
- @Column(name = "city")
@NotEmpty
private String city;
- @Column(name = "telephone")
@NotEmpty
@Digits(fraction = 0, integer = 10)
private String telephone;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- private SetOwner
domain objects All method names are compliant
@@ -33,7 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
* @author Sam Brannen
* @author Michael Isvy
*/
-public interface OwnerRepository extends RepositoryPet
domain objects All method names are compliant
@@ -32,28 +32,9 @@ import org.springframework.transaction.annotation.Transactional;
* @author Sam Brannen
* @author Michael Isvy
*/
-public interface PetRepository extends RepositoryVet
s from the data store.
- * @return a Collection
of Vet
s
- */
- @Transactional(readOnly = true)
- @Cacheable("vets")
- CollectionVisit
domain objects All method names are compliant
- * with Spring Data naming conventions so this interface can easily be extended for Spring
- * Data. See:
- * https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-creation
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Michael Isvy
- */
-public interface VisitRepository extends RepositoryVisit
to the data store, either inserting or updating it.
- * @param visit the Visit
to save
- * @see BaseEntity#isNew
- */
- void save(Visit visit) throws DataAccessException;
-
- List
|
@@ -61,7 +61,7 @@ | |
+ | ||