Browse Source

entidades

master
Cristobal Bernal Mayordomo 1 year ago
parent
commit
722f7e6d7c
8 changed files with 68 additions and 280 deletions
  1. +18
    -0
      META-INF/persistence.xml
  2. +0
    -90
      src/main/java/com/cristobalbernal/foro/entidades/AutorsEntity.java
  3. +0
    -13
      src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java
  4. +5
    -44
      src/main/java/com/cristobalbernal/foro/entidades/ForoEntity.java
  5. +0
    -51
      src/main/java/com/cristobalbernal/foro/entidades/ImagenEntity.java
  6. +28
    -15
      src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java
  7. +0
    -51
      src/main/java/com/cristobalbernal/foro/entidades/TipoPrivileguiosEntity.java
  8. +17
    -16
      src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java

+ 18
- 0
META-INF/persistence.xml View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="https://jakarta.ee/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
version="3.0">
<persistence-unit name="default">
<class>com.cristobalbernal.foro.entidades.CategoriaForoEntity</class>
<class>com.cristobalbernal.foro.entidades.ForoEntity</class>
<class>com.cristobalbernal.foro.entidades.RespuestasEntity</class>
<class>com.cristobalbernal.foro.entidades.UsersEntity</class>
<properties>
<property name="hibernate.connection.url" value="jdbc:mariadb://localhost:3306/foro"/>
<property name="hibernate.connection.driver_class" value="org.mariadb.jdbc.Driver"/>
<property name="hibernate.connection.username" value="root"/>
</properties>
</persistence-unit>
</persistence>

+ 0
- 90
src/main/java/com/cristobalbernal/foro/entidades/AutorsEntity.java View File

@ -1,90 +0,0 @@
package com.cristobalbernal.foro.entidades;
import jakarta.persistence.*;
@Entity
@Table(name = "autors", schema = "foro", catalog = "")
public class AutorsEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "imagen", nullable = true, length = 45)
private String imagen;
@Basic
@Column(name = "name", nullable = true, length = 45)
private String name;
@Basic
@Column(name = "surnames", nullable = true, length = 45)
private String surnames;
@Basic
@Column(name = "email", nullable = true, length = 45)
private String email;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getImagen() {
return imagen;
}
public void setImagen(String imagen) {
this.imagen = imagen;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurnames() {
return surnames;
}
public void setSurnames(String surnames) {
this.surnames = surnames;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AutorsEntity that = (AutorsEntity) o;
if (id != that.id) return false;
if (imagen != null ? !imagen.equals(that.imagen) : that.imagen != null) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (surnames != null ? !surnames.equals(that.surnames) : that.surnames != null) return false;
if (email != null ? !email.equals(that.email) : that.email != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (imagen != null ? imagen.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (surnames != null ? surnames.hashCode() : 0);
result = 31 * result + (email != null ? email.hashCode() : 0);
return result;
}
}

+ 0
- 13
src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java View File

@ -15,9 +15,6 @@ public class CategoriaForoEntity {
@Basic @Basic
@Column(name = "descripcion", nullable = true, length = 45) @Column(name = "descripcion", nullable = true, length = 45)
private String descripcion; private String descripcion;
@Basic
@Column(name = "users_id", nullable = false)
private int usersId;
public int getId() { public int getId() {
return id; return id;
@ -43,14 +40,6 @@ public class CategoriaForoEntity {
this.descripcion = descripcion; this.descripcion = descripcion;
} }
public int getUsersId() {
return usersId;
}
public void setUsersId(int usersId) {
this.usersId = usersId;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
@ -59,7 +48,6 @@ public class CategoriaForoEntity {
CategoriaForoEntity that = (CategoriaForoEntity) o; CategoriaForoEntity that = (CategoriaForoEntity) o;
if (id != that.id) return false; if (id != that.id) return false;
if (usersId != that.usersId) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false; if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false; if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false;
@ -71,7 +59,6 @@ public class CategoriaForoEntity {
int result = id; int result = id;
result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0); result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0);
result = 31 * result + usersId;
return result; return result;
} }
} }

src/main/java/com/cristobalbernal/foro/entidades/ForoPrincipalEntity.java → src/main/java/com/cristobalbernal/foro/entidades/ForoEntity.java View File

@ -5,36 +5,27 @@ import jakarta.persistence.*;
import java.sql.Timestamp; import java.sql.Timestamp;
@Entity @Entity
@Table(name = "foro_principal", schema = "foro", catalog = "")
public class ForoPrincipalEntity {
@Table(name = "foro", schema = "foro", catalog = "")
public class ForoEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Id @Id
@Column(name = "id", nullable = false) @Column(name = "id", nullable = false)
private int id; private int id;
@Basic @Basic
@Column(name = "titulo", nullable = true, length = 45)
@Column(name = "titulo", nullable = true, length = 150)
private String titulo; private String titulo;
@Basic @Basic
@Column(name = "descripcion", nullable = true, length = 45)
@Column(name = "descripcion", nullable = true, length = 150)
private String descripcion; private String descripcion;
@Basic @Basic
@Column(name = "fechaYHora", nullable = true) @Column(name = "fechaYHora", nullable = true)
private Timestamp fechaYHora; private Timestamp fechaYHora;
@Basic @Basic
@Column(name = "autors_id", nullable = false)
private int autorsId;
@Basic
@Column(name = "imagen_id", nullable = false) @Column(name = "imagen_id", nullable = false)
private int imagenId; private int imagenId;
@Basic @Basic
@Column(name = "users_id", nullable = false)
private int usersId;
@Basic
@Column(name = "categoria_foro_id", nullable = false) @Column(name = "categoria_foro_id", nullable = false)
private int categoriaForoId; private int categoriaForoId;
@Basic
@Column(name = "Respuestas_id", nullable = false)
private int respuestasId;
public int getId() { public int getId() {
return id; return id;
@ -68,14 +59,6 @@ public class ForoPrincipalEntity {
this.fechaYHora = fechaYHora; this.fechaYHora = fechaYHora;
} }
public int getAutorsId() {
return autorsId;
}
public void setAutorsId(int autorsId) {
this.autorsId = autorsId;
}
public int getImagenId() { public int getImagenId() {
return imagenId; return imagenId;
} }
@ -84,14 +67,6 @@ public class ForoPrincipalEntity {
this.imagenId = imagenId; this.imagenId = imagenId;
} }
public int getUsersId() {
return usersId;
}
public void setUsersId(int usersId) {
this.usersId = usersId;
}
public int getCategoriaForoId() { public int getCategoriaForoId() {
return categoriaForoId; return categoriaForoId;
} }
@ -100,27 +75,16 @@ public class ForoPrincipalEntity {
this.categoriaForoId = categoriaForoId; this.categoriaForoId = categoriaForoId;
} }
public int getRespuestasId() {
return respuestasId;
}
public void setRespuestasId(int respuestasId) {
this.respuestasId = respuestasId;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null || getClass() != o.getClass()) return false;
ForoPrincipalEntity that = (ForoPrincipalEntity) o;
ForoEntity that = (ForoEntity) o;
if (id != that.id) return false; if (id != that.id) return false;
if (autorsId != that.autorsId) return false;
if (imagenId != that.imagenId) return false; if (imagenId != that.imagenId) return false;
if (usersId != that.usersId) return false;
if (categoriaForoId != that.categoriaForoId) return false; if (categoriaForoId != that.categoriaForoId) return false;
if (respuestasId != that.respuestasId) return false;
if (titulo != null ? !titulo.equals(that.titulo) : that.titulo != null) return false; if (titulo != null ? !titulo.equals(that.titulo) : that.titulo != null) return false;
if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false; if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false;
if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false; if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false;
@ -134,11 +98,8 @@ public class ForoPrincipalEntity {
result = 31 * result + (titulo != null ? titulo.hashCode() : 0); result = 31 * result + (titulo != null ? titulo.hashCode() : 0);
result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0); result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0);
result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0); result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0);
result = 31 * result + autorsId;
result = 31 * result + imagenId; result = 31 * result + imagenId;
result = 31 * result + usersId;
result = 31 * result + categoriaForoId; result = 31 * result + categoriaForoId;
result = 31 * result + respuestasId;
return result; return result;
} }
} }

+ 0
- 51
src/main/java/com/cristobalbernal/foro/entidades/ImagenEntity.java View File

@ -1,51 +0,0 @@
package com.cristobalbernal.foro.entidades;
import jakarta.persistence.*;
@Entity
@Table(name = "imagen", schema = "foro", catalog = "")
public class ImagenEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "url", nullable = true, length = 45)
private String url;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImagenEntity that = (ImagenEntity) o;
if (id != that.id) return false;
if (url != null ? !url.equals(that.url) : that.url != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (url != null ? url.hashCode() : 0);
return result;
}
}

+ 28
- 15
src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java View File

@ -15,14 +15,17 @@ public class RespuestasEntity {
@Column(name = "Post", nullable = true, length = 45) @Column(name = "Post", nullable = true, length = 45)
private String post; private String post;
@Basic @Basic
@Column(name = "fechaYHora", nullable = true)
private Timestamp fechaYHora;
@Basic
@Column(name = "Respuestas_id", nullable = false) @Column(name = "Respuestas_id", nullable = false)
private int respuestasId; private int respuestasId;
@Basic @Basic
@Column(name = "autors_id", nullable = false)
private int autorsId;
@Column(name = "users_id", nullable = false)
private int usersId;
@Basic @Basic
@Column(name = "fechaYHora", nullable = true)
private Timestamp fechaYHora;
@Column(name = "Foro_id", nullable = false)
private int foroId;
public int getId() { public int getId() {
return id; return id;
@ -40,6 +43,14 @@ public class RespuestasEntity {
this.post = post; this.post = post;
} }
public Timestamp getFechaYHora() {
return fechaYHora;
}
public void setFechaYHora(Timestamp fechaYHora) {
this.fechaYHora = fechaYHora;
}
public int getRespuestasId() { public int getRespuestasId() {
return respuestasId; return respuestasId;
} }
@ -48,20 +59,20 @@ public class RespuestasEntity {
this.respuestasId = respuestasId; this.respuestasId = respuestasId;
} }
public int getAutorsId() {
return autorsId;
public int getUsersId() {
return usersId;
} }
public void setAutorsId(int autorsId) {
this.autorsId = autorsId;
public void setUsersId(int usersId) {
this.usersId = usersId;
} }
public Timestamp getFechaYHora() {
return fechaYHora;
public int getForoId() {
return foroId;
} }
public void setFechaYHora(Timestamp fechaYHora) {
this.fechaYHora = fechaYHora;
public void setForoId(int foroId) {
this.foroId = foroId;
} }
@Override @Override
@ -73,7 +84,8 @@ public class RespuestasEntity {
if (id != that.id) return false; if (id != that.id) return false;
if (respuestasId != that.respuestasId) return false; if (respuestasId != that.respuestasId) return false;
if (autorsId != that.autorsId) return false;
if (usersId != that.usersId) return false;
if (foroId != that.foroId) return false;
if (post != null ? !post.equals(that.post) : that.post != null) return false; if (post != null ? !post.equals(that.post) : that.post != null) return false;
if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false; if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false;
@ -84,9 +96,10 @@ public class RespuestasEntity {
public int hashCode() { public int hashCode() {
int result = id; int result = id;
result = 31 * result + (post != null ? post.hashCode() : 0); result = 31 * result + (post != null ? post.hashCode() : 0);
result = 31 * result + respuestasId;
result = 31 * result + autorsId;
result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0); result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0);
result = 31 * result + respuestasId;
result = 31 * result + usersId;
result = 31 * result + foroId;
return result; return result;
} }
} }

+ 0
- 51
src/main/java/com/cristobalbernal/foro/entidades/TipoPrivileguiosEntity.java View File

@ -1,51 +0,0 @@
package com.cristobalbernal.foro.entidades;
import jakarta.persistence.*;
@Entity
@Table(name = "tipo_privileguios", schema = "foro", catalog = "")
public class TipoPrivileguiosEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "tipo", nullable = true, length = 45)
private String tipo;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTipo() {
return tipo;
}
public void setTipo(String tipo) {
this.tipo = tipo;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TipoPrivileguiosEntity that = (TipoPrivileguiosEntity) o;
if (id != that.id) return false;
if (tipo != null ? !tipo.equals(that.tipo) : that.tipo != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (tipo != null ? tipo.hashCode() : 0);
return result;
}
}

+ 17
- 16
src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java View File

@ -28,11 +28,11 @@ public class UsersEntity {
@Column(name = "username", nullable = true, length = 45) @Column(name = "username", nullable = true, length = 45)
private String username; private String username;
@Basic @Basic
@Column(name = "imagen_id", nullable = false)
private int imagenId;
@Column(name = "urlImgen", nullable = true, length = 150)
private String urlImgen;
@Basic @Basic
@Column(name = "tipo_privileguios_id", nullable = false)
private int tipoPrivileguiosId;
@Column(name = "tipoPrivilegios", nullable = true)
private Byte tipoPrivilegios;
public int getId() { public int getId() {
return id; return id;
@ -90,20 +90,20 @@ public class UsersEntity {
this.username = username; this.username = username;
} }
public int getImagenId() {
return imagenId;
public String getUrlImgen() {
return urlImgen;
} }
public void setImagenId(int imagenId) {
this.imagenId = imagenId;
public void setUrlImgen(String urlImgen) {
this.urlImgen = urlImgen;
} }
public int getTipoPrivileguiosId() {
return tipoPrivileguiosId;
public Byte getTipoPrivilegios() {
return tipoPrivilegios;
} }
public void setTipoPrivileguiosId(int tipoPrivileguiosId) {
this.tipoPrivileguiosId = tipoPrivileguiosId;
public void setTipoPrivilegios(Byte tipoPrivilegios) {
this.tipoPrivilegios = tipoPrivilegios;
} }
@Override @Override
@ -114,14 +114,15 @@ public class UsersEntity {
UsersEntity that = (UsersEntity) o; UsersEntity that = (UsersEntity) o;
if (id != that.id) return false; if (id != that.id) return false;
if (imagenId != that.imagenId) return false;
if (tipoPrivileguiosId != that.tipoPrivileguiosId) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false; if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (firstname != null ? !firstname.equals(that.firstname) : that.firstname != null) return false; if (firstname != null ? !firstname.equals(that.firstname) : that.firstname != null) return false;
if (secondname != null ? !secondname.equals(that.secondname) : that.secondname != null) return false; if (secondname != null ? !secondname.equals(that.secondname) : that.secondname != null) return false;
if (password != null ? !password.equals(that.password) : that.password != null) return false; if (password != null ? !password.equals(that.password) : that.password != null) return false;
if (email != null ? !email.equals(that.email) : that.email != null) return false; if (email != null ? !email.equals(that.email) : that.email != null) return false;
if (username != null ? !username.equals(that.username) : that.username != null) return false; if (username != null ? !username.equals(that.username) : that.username != null) return false;
if (urlImgen != null ? !urlImgen.equals(that.urlImgen) : that.urlImgen != null) return false;
if (tipoPrivilegios != null ? !tipoPrivilegios.equals(that.tipoPrivilegios) : that.tipoPrivilegios != null)
return false;
return true; return true;
} }
@ -135,8 +136,8 @@ public class UsersEntity {
result = 31 * result + (password != null ? password.hashCode() : 0); result = 31 * result + (password != null ? password.hashCode() : 0);
result = 31 * result + (email != null ? email.hashCode() : 0); result = 31 * result + (email != null ? email.hashCode() : 0);
result = 31 * result + (username != null ? username.hashCode() : 0); result = 31 * result + (username != null ? username.hashCode() : 0);
result = 31 * result + imagenId;
result = 31 * result + tipoPrivileguiosId;
result = 31 * result + (urlImgen != null ? urlImgen.hashCode() : 0);
result = 31 * result + (tipoPrivilegios != null ? tipoPrivilegios.hashCode() : 0);
return result; return result;
} }
} }

Loading…
Cancel
Save