mirror of
https://gitlab.com/tutorial-java-rafa-munoz/tutorial-java-2024-25/tutorialjava2024-25.git
synced 2025-11-10 02:13:07 +01:00
131 lines
2.2 KiB
Java
131 lines
2.2 KiB
Java
package tutorialJava.modelosBasesDeDatosComunesJPA.ventaDeCoches;
|
|
|
|
import java.io.Serializable;
|
|
import javax.persistence.*;
|
|
|
|
import tutorialJava.modelosBasesDeDatosComunesJPA.Entidad;
|
|
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
* The persistent class for the cliente database table.
|
|
*
|
|
*/
|
|
@Entity
|
|
@NamedQuery(name="Cliente.findAll", query="SELECT c FROM Cliente c")
|
|
public class Cliente extends Entidad implements Serializable {
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@Id
|
|
@GeneratedValue(strategy=GenerationType.AUTO)
|
|
private int id;
|
|
|
|
private boolean activo;
|
|
|
|
private String apellidos;
|
|
|
|
private String dniNie;
|
|
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
private Date fechaNac;
|
|
|
|
private String localidad;
|
|
|
|
private String nombre;
|
|
|
|
//bi-directional many-to-one association to Venta
|
|
@OneToMany(mappedBy="cliente")
|
|
private List<Venta> ventas;
|
|
|
|
public Cliente() {
|
|
}
|
|
|
|
public int getId() {
|
|
return this.id;
|
|
}
|
|
|
|
public void setId(int id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public boolean getActivo() {
|
|
return this.activo;
|
|
}
|
|
|
|
public void setActivo(boolean activo) {
|
|
this.activo = activo;
|
|
}
|
|
|
|
public String getApellidos() {
|
|
return this.apellidos;
|
|
}
|
|
|
|
public void setApellidos(String apellidos) {
|
|
this.apellidos = apellidos;
|
|
}
|
|
|
|
public String getDniNie() {
|
|
return this.dniNie;
|
|
}
|
|
|
|
public void setDniNie(String dniNie) {
|
|
this.dniNie = dniNie;
|
|
}
|
|
|
|
public Date getFechaNac() {
|
|
return this.fechaNac;
|
|
}
|
|
|
|
public void setFechaNac(Date fechaNac) {
|
|
this.fechaNac = fechaNac;
|
|
}
|
|
|
|
public String getLocalidad() {
|
|
return this.localidad;
|
|
}
|
|
|
|
public void setLocalidad(String localidad) {
|
|
this.localidad = localidad;
|
|
}
|
|
|
|
public String getNombre() {
|
|
return this.nombre;
|
|
}
|
|
|
|
public void setNombre(String nombre) {
|
|
this.nombre = nombre;
|
|
}
|
|
|
|
public List<Venta> getVentas() {
|
|
return this.ventas;
|
|
}
|
|
|
|
public void setVentas(List<Venta> ventas) {
|
|
this.ventas = ventas;
|
|
}
|
|
|
|
public Venta addVenta(Venta venta) {
|
|
getVentas().add(venta);
|
|
venta.setCliente(this);
|
|
|
|
return venta;
|
|
}
|
|
|
|
public Venta removeVenta(Venta venta) {
|
|
getVentas().remove(venta);
|
|
venta.setCliente(null);
|
|
|
|
return venta;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return this.nombre + " " + this.apellidos;
|
|
}
|
|
|
|
|
|
|
|
|
|
} |