I have a problem loading a table from a MySQL database. The table is in PrimeFaces and loads the data from the database when I deploy the application. But when I modify a data, even though it loads it into the database, it does not show it in the table.
Edited
Here something of the code .. it does not work for me with the property refresh through the commandbutton ..
<p:panel id="tabla" style="width: 100% ; font-size: small; text-align: left ; border : none ;" >
<p:dataTable style="border : none ;"
id="tablePro" var="programacion" value="#{mantenimientoTvista.listaProgramaciontodo}" rows="10"
paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15"
filteredValue="#{mantenimientoTvista.listaProgramaciontodo}"
emptyMessage="No se encontraron resultados"
selectionMode="single"
rowKey="#{programacion.idprogramacion}"
selection="#{mantenimientoTvista.programacionSeleccionado}"
>
<p:ajax event="rowSelect" listener="#{mantenimientoTvista.funcionSeleccionarProd}" update="forma:growl ,:forma:campos" />
<p:column headerText="nombre tecnico" width="30" filterBy="#{programacion.documentotecnico.personal.nombrepersonal}">
<h:outputText value="#{programacion.documentotecnico.personal.nombrepersonal}"/>
<p:column headerText="Tipo mant" width="5" filterBy="#{programacion.idclase.clasenombre}" filterMatchMode="contains">
<h:outputText value="#{programacion.idclase.clasenombre}"/>
</p:column>
</p:dataTable>
</p:panel>
and this is the button I leave the code here apart ------------------------------------- ---
and here the value code of technicallist (I omit many columns so as not to paste a code too long, I just need to refresh the name of the technician when I change it in the table).
This is an entity class from the database ..
@Entity
@Table(name = "personal")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Personal.findAll", query = "SELECT p FROM Personal p"),
@NamedQuery(name = "Personal.findByDocumentopersonal", query = "SELECT p FROM Personal p WHERE p.documentopersonal = :documentopersonal"),
@NamedQuery(name = "Personal.findByApellidopersonal", query = "SELECT p FROM Personal p WHERE p.apellidopersonal = :apellidopersonal"),
@NamedQuery(name = "Personal.findByClavepersonal", query = "SELECT p FROM Personal p WHERE p.clavepersonal = :clavepersonal"),
@NamedQuery(name = "Personal.findByNombrepersonal", query = "SELECT p FROM Personal p WHERE p.nombrepersonal = :nombrepersonal")})
public class Personal implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "documentopersonal")
private Long documentopersonal;
@Size(max = 255)
@Column(name = "apellidopersonal")
private String apellidopersonal;
@Size(max = 255)
@Column(name = "clavepersonal")
private String clavepersonal;
@Size(max = 255)
@Column(name = "nombrepersonal")
private String nombrepersonal;
@OneToOne(cascade = CascadeType.ALL, mappedBy = "personal")
private Administrador administrador;
@OneToOne(cascade = CascadeType.ALL, mappedBy = "personal")
private Tecnicos tecnicos;
public Personal() {
}
public Personal(Long documentopersonal) {
this.documentopersonal = documentopersonal;
}
public Long getDocumentopersonal() {
return documentopersonal;
}
public void setDocumentopersonal(Long documentopersonal) {
this.documentopersonal = documentopersonal;
}
public String getApellidopersonal() {
return apellidopersonal;
}
public void setApellidopersonal(String apellidopersonal) {
this.apellidopersonal = apellidopersonal;
}
public String getClavepersonal() {
return clavepersonal;
}
public void setClavepersonal(String clavepersonal) {
this.clavepersonal = clavepersonal;
}
public String getNombrepersonal() {
return nombrepersonal;
}
public void setNombrepersonal(String nombrepersonal) {
this.nombrepersonal = nombrepersonal;
}
public Administrador getAdministrador() {
return administrador;
}
public void setAdministrador(Administrador administrador) {
this.administrador = administrador;
}
public Tecnicos getTecnicos() {
return tecnicos;
}
public void setTecnicos(Tecnicos tecnicos) {
this.tecnicos = tecnicos;
}
@Override
public int hashCode() {
int hash = 0;
hash += (documentopersonal != null ? documentopersonal.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Personal)) {
return false;
}
Personal other = (Personal) object;
if ((this.documentopersonal == null && other.documentopersonal != null) || (this.documentopersonal != null && !this.documentopersonal.equals(other.documentopersonal))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.simap.modelo.Personal[ documentopersonal=" + documentopersonal + " ]";
}
}