Ejemplo de paginación (Listado de preguntas pendientes) con primefaces
utilizando LazyDataModel, con recarga automática de la página solicitada.
This commit is contained in:
@@ -5,6 +5,8 @@ import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
@@ -12,11 +14,12 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import common.TestType;
|
||||
|
||||
/**
|
||||
* Los nombres de los decortadores relacionados con la BBDD pueden estar
|
||||
* en camelCase, snakeCase o como se quiera, puesto que en persistence.xml
|
||||
* se tiene dicho que se convierta a minúsculas.
|
||||
* Los nombres de los decortadores relacionados con la BBDD pueden estar en
|
||||
* camelCase, snakeCase o como se quiera, puesto que en persistence.xml se tiene
|
||||
* dicho que se convierta a minúsculas.
|
||||
*
|
||||
* Lo uso en minúsculas para mejorar la trazabilidad de los campos.
|
||||
*
|
||||
@@ -30,29 +33,30 @@ public class MedicalTestJPA implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private int id;
|
||||
private Date date;
|
||||
private long time;
|
||||
private String observations;
|
||||
private String highresimage;
|
||||
@Column(name = "type") // Con esto podríamos cambiar los nombres de las propiedades de la clase y mantener la relación con la BBDD a través de JPA
|
||||
private int type;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "type") // Con esto podríamos cambiar los nombres de las propiedades de la clase y
|
||||
// mantener la relación con la BBDD a través de JPA
|
||||
private TestType type;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn (name="patientid")
|
||||
@JoinColumn(name = "patientid")
|
||||
private PatientJPA patient;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn (name="specialistdoctorid")
|
||||
@JoinColumn(name = "specialistdoctorid")
|
||||
private SpecialistDoctorJPA specialistDoctor;
|
||||
|
||||
public MedicalTestJPA() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MedicalTestJPA(int id, Date date, long time, String observations, String highresimage, int type,
|
||||
PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
||||
|
||||
public MedicalTestJPA(int id, Date date, long time, String observations, String highresimage, TestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
||||
this.id = id;
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
@@ -103,11 +107,11 @@ public class MedicalTestJPA implements Serializable {
|
||||
this.highresimage = highresimage;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
public TestType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
public void setType(TestType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@@ -127,6 +131,4 @@ public class MedicalTestJPA implements Serializable {
|
||||
this.specialistDoctor = specialistDoctor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user