mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
Arreglo de las clases respecto develop
This commit is contained in:
parent
6a63b08705
commit
652ca51d7e
3 changed files with 28 additions and 53 deletions
|
@ -1,31 +1,18 @@
|
|||
package org.springframework.cheapy.model;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Entity
|
||||
@Table(name = "authorities")
|
||||
public class Authorities extends BaseEntity {
|
||||
public class Authorities {
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "username")
|
||||
User user;
|
||||
@Id
|
||||
String username;
|
||||
|
||||
@Size(min = 3, max = 50)
|
||||
String authority;
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getAuthority() {
|
||||
return authority;
|
||||
}
|
||||
|
|
|
@ -1,33 +1,13 @@
|
|||
/*
|
||||
* 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.cheapy.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Digits;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* Simple JavaBean domain object representing an owner.
|
||||
*
|
||||
* @author Ken Krebs
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @author Michael Isvy
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "clients")
|
||||
public class Client extends User {
|
||||
|
@ -51,6 +31,18 @@ public class Client extends User {
|
|||
@NotEmpty
|
||||
private String food;
|
||||
|
||||
@OneToMany
|
||||
private Set<FoodOffer> foodOffers;
|
||||
|
||||
@OneToMany
|
||||
private Set<NuOffer> nuOffers;
|
||||
|
||||
@OneToMany
|
||||
private Set<SpeedOffer> speedOffers;
|
||||
|
||||
@OneToMany
|
||||
private Set<TimeOffer> timeOffers;
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
package org.springframework.cheapy.model;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
public class User {
|
||||
|
||||
@Id
|
||||
@MappedSuperclass
|
||||
public class User extends BaseEntity {
|
||||
|
||||
@NotBlank
|
||||
String username;
|
||||
|
||||
|
@ -24,6 +20,9 @@ public class User {
|
|||
@NotBlank
|
||||
String email;
|
||||
|
||||
@OneToOne
|
||||
Authorities authority;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
@ -56,7 +55,4 @@ public class User {
|
|||
this.authority = authority;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, mappedBy = "user", fetch = FetchType.LAZY)
|
||||
private Authorities authority;
|
||||
|
||||
}
|
Loading…
Reference in a new issue