Browse Source

Importando entidades de la BBDD

master
Juanjo 1 year ago
parent
commit
f39ed6cb1e
4 changed files with 310 additions and 0 deletions
  1. +121
    -0
      src/main/java/es/fp/edu/conecta2/modelo2/IbexEntity.java
  2. +63
    -0
      src/main/java/es/fp/edu/conecta2/modelo2/Tabla1Entity.java
  3. +75
    -0
      src/main/java/es/fp/edu/conecta2/modelo2/Tabla2Entity.java
  4. +51
    -0
      src/main/java/es/fp/edu/conecta2/modelo2/Tabla3Entity.java

+ 121
- 0
src/main/java/es/fp/edu/conecta2/modelo2/IbexEntity.java View File

@ -0,0 +1,121 @@
package es.fp.edu.conecta2.modelo2;
import jakarta.persistence.Basic;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import java.math.BigDecimal;
import java.sql.Date;
@Entity
@Table(name = "ibex", schema = "bolsa", catalog = "")
public class IbexEntity {
@Basic
@Column(name = "date", nullable = false)
private Date date;
@Basic
@Column(name = "open", nullable = false, precision = 6)
private BigDecimal open;
@Basic
@Column(name = "high", nullable = false, precision = 6)
private BigDecimal high;
@Basic
@Column(name = "low", nullable = false, precision = 6)
private BigDecimal low;
@Basic
@Column(name = "close", nullable = false, precision = 6)
private BigDecimal close;
@Basic
@Column(name = "adj_close", nullable = false, precision = 6)
private BigDecimal adjClose;
@Basic
@Column(name = "volume", nullable = false)
private int volume;
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public BigDecimal getOpen() {
return open;
}
public void setOpen(BigDecimal open) {
this.open = open;
}
public BigDecimal getHigh() {
return high;
}
public void setHigh(BigDecimal high) {
this.high = high;
}
public BigDecimal getLow() {
return low;
}
public void setLow(BigDecimal low) {
this.low = low;
}
public BigDecimal getClose() {
return close;
}
public void setClose(BigDecimal close) {
this.close = close;
}
public BigDecimal getAdjClose() {
return adjClose;
}
public void setAdjClose(BigDecimal adjClose) {
this.adjClose = adjClose;
}
public int getVolume() {
return volume;
}
public void setVolume(int volume) {
this.volume = volume;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IbexEntity that = (IbexEntity) o;
if (volume != that.volume) return false;
if (date != null ? !date.equals(that.date) : that.date != null) return false;
if (open != null ? !open.equals(that.open) : that.open != null) return false;
if (high != null ? !high.equals(that.high) : that.high != null) return false;
if (low != null ? !low.equals(that.low) : that.low != null) return false;
if (close != null ? !close.equals(that.close) : that.close != null) return false;
if (adjClose != null ? !adjClose.equals(that.adjClose) : that.adjClose != null) return false;
return true;
}
@Override
public int hashCode() {
int result = date != null ? date.hashCode() : 0;
result = 31 * result + (open != null ? open.hashCode() : 0);
result = 31 * result + (high != null ? high.hashCode() : 0);
result = 31 * result + (low != null ? low.hashCode() : 0);
result = 31 * result + (close != null ? close.hashCode() : 0);
result = 31 * result + (adjClose != null ? adjClose.hashCode() : 0);
result = 31 * result + volume;
return result;
}
}

+ 63
- 0
src/main/java/es/fp/edu/conecta2/modelo2/Tabla1Entity.java View File

@ -0,0 +1,63 @@
package es.fp.edu.conecta2.modelo2;
import jakarta.persistence.*;
import java.util.Collection;
@Entity
@Table(name = "tabla1", schema = "bolsa", catalog = "")
public class Tabla1Entity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "nombre", nullable = false, length = 50)
private String nombre;
@OneToMany(mappedBy = "tabla1ByTabla1Id")
private Collection<Tabla2Entity> tabla2sById;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tabla1Entity that = (Tabla1Entity) o;
if (id != that.id) return false;
if (nombre != null ? !nombre.equals(that.nombre) : that.nombre != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (nombre != null ? nombre.hashCode() : 0);
return result;
}
public Collection<Tabla2Entity> getTabla2sById() {
return tabla2sById;
}
public void setTabla2sById(Collection<Tabla2Entity> tabla2sById) {
this.tabla2sById = tabla2sById;
}
}

+ 75
- 0
src/main/java/es/fp/edu/conecta2/modelo2/Tabla2Entity.java View File

@ -0,0 +1,75 @@
package es.fp.edu.conecta2.modelo2;
import jakarta.persistence.*;
@Entity
@Table(name = "tabla2", schema = "bolsa", catalog = "")
public class Tabla2Entity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "nombre", nullable = true, length = 50)
private String nombre;
@Basic
@Column(name = "tabla1_id", nullable = false)
private int tabla1Id;
@ManyToOne
@JoinColumn(name = "tabla1_id", referencedColumnName = "id", nullable = false)
private Tabla1Entity tabla1ByTabla1Id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public int getTabla1Id() {
return tabla1Id;
}
public void setTabla1Id(int tabla1Id) {
this.tabla1Id = tabla1Id;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tabla2Entity that = (Tabla2Entity) o;
if (id != that.id) return false;
if (tabla1Id != that.tabla1Id) return false;
if (nombre != null ? !nombre.equals(that.nombre) : that.nombre != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (nombre != null ? nombre.hashCode() : 0);
result = 31 * result + tabla1Id;
return result;
}
public Tabla1Entity getTabla1ByTabla1Id() {
return tabla1ByTabla1Id;
}
public void setTabla1ByTabla1Id(Tabla1Entity tabla1ByTabla1Id) {
this.tabla1ByTabla1Id = tabla1ByTabla1Id;
}
}

+ 51
- 0
src/main/java/es/fp/edu/conecta2/modelo2/Tabla3Entity.java View File

@ -0,0 +1,51 @@
package es.fp.edu.conecta2.modelo2;
import jakarta.persistence.*;
@Entity
@Table(name = "tabla3", schema = "bolsa", catalog = "")
public class Tabla3Entity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "nombre", nullable = true, length = 45)
private String nombre;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tabla3Entity that = (Tabla3Entity) o;
if (id != that.id) return false;
if (nombre != null ? !nombre.equals(that.nombre) : that.nombre != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (nombre != null ? nombre.hashCode() : 0);
return result;
}
}

Loading…
Cancel
Save