I have the following table that shows a list of people and when clicking on a row, sends me to another page
<p:dataTable var="consultaPersona" style="max-width:3000px;max-height:770px;" value="#{NivelesPersonaComponent.listNivelesPersona}" emptyMessage="No se encontraron registros." selectionMode="single" selection="#{NivelesPersonaComponent.nivelespersona1}"
rowKey="#{consultaPersona.persona.cveIdPersona}">
<p:ajax event="rowSelect" listener="#{NivelesPersonaComponent.mostrarPantallaHorario}" />
<p:column headerText="No.Empleado">
<h:outputText value="#{consultaPersona.persona.noEmpleado}" />
</p:column>
<p:column headerText="RFC">
<h:outputText value="#{consultaPersona.persona.rfc}" />
</p:column>
<p:column headerText="Nombre">
<h:outputText value="#{consultaPersona.persona.nombre}" />
</p:column>
<p:column headerText="Ubicacion">
<h:outputText value="#{consultaPersona.unidadAdministrativa.cveIdUnidadAdmin} -#{consultaPersona.unidadAdministrativa.desUnidadAdministrativa}" />
</p:column>
<p:column headerText="Entrada">
<h:outputText value="#{consultaPersona.horarios.horarioEntrada}" />
</p:column>
<p:column headerText="Salida">
<h:outputText value="#{consultaPersona.horarios.horarioSalida}" />
</p:column>
</p:dataTable>
![](https://i.stack.imgur.com/0k1hk.png)
On the other page, I have a button that when clicked shows a dialog that contains the info of that selected person
<p:dialog header="Establecer Horario" widgetVar="modalHorario" modal="true" height="300" width="600px" appendTo="@(body)">
<h:outputLabel value="Horario" styleClass="estiloletra" />
<p:spacer width="35" height="1" />
<p:selectOneMenu id="horario" autoWidth="false" style="width:155px" value="#{NivelesPersonaComponent.nivelespersona1.horarios.cveIdHorario}">
<f:selectItem itemLabel="Seleccione" />
<f:selectItems value="#{HorariosComponent.listHorarioss()}" var="horario" itemValue="#{horario.cveIdHorario}" itemLabel="#{horario.horarioEntrada} a #{horario.horarioSalida} Tolerancia #{horario.toleranciaRetardo} Falta #{horario.toleranciaFalta} ">
</f:selectItems>
</p:selectOneMenu>
<br></br>
<h:outputLabel value="Ubicación" styleClass="estiloletra" />
<p:spacer width="20" height="1" />
<p:selectOneMenu id="ubicacion" autoWidth="false" style="width:155px" value="#{NivelesPersonaComponent.nivelespersona1.unidadAdministrativa.cveIdUnidadAdmin}">
<f:selectItem itemLabel="Seleccione" />
<f:selectItems value="#{UnidadAdministrativaComponent.listUnidadAdministrativas()}" var="ubicacion" itemValue="#{ubicacion.cveIdUnidadAdmin}" itemLabel="#{ubicacion.cveIdUnidadAdmin} - #{ubicacion.desUnidadAdministrativa}">
</f:selectItems>
</p:selectOneMenu>
<br></br>
<br></br>
<h:outputLabel value="Fec.Inicio" styleClass="estiloletra" />
<p:spacer width="20" height="1" />
<p:calendar id="popup" placeholder="Fecha Inicio" pattern="dd/MM/yyyy" locale="es" value="#{NivelesPersonaComponent.nivelespersona1.fecInicioNivel}" />
<p:spacer width="20" height="1" />
<h:outputLabel value="Fec.Fin" styleClass="estiloletra" />
<p:spacer width="25" height="1" />
<p:calendar id="popup1" placeholder="Fecha Fin" pattern="dd/MM/yyyy" locale="es" value="#{NivelesPersonaComponent.nivelespersona1.fecFinNivel}" />
<br></br>
<br></br>
<h:outputLabel value="Obs." styleClass="estiloletra" />
<p:spacer width="50" height="1" />
<p:inputText placeholder="Observaciones" />
<br></br>
<br></br>
<p:selectBooleanCheckbox value="#{NivelesPersonaComponent.nivelespersona1.checaLunes}" />
<p:spacer width="10" />
<h:outputLabel value="Lunes" styleClass="estiloletra" />
<p:spacer width="10" height="1" />
<p:selectBooleanCheckbox value="#{NivelesPersonaComponent.nivelespersona1.checaMartes}" />
<p:spacer width="10" />
<h:outputLabel value="Martes" styleClass="estiloletra" />
<p:spacer width="10" height="1" />
<p:selectBooleanCheckbox value="#{NivelesPersonaComponent.nivelespersona1.checaMiercoles}" />
<p:spacer width="10" />
<h:outputLabel value="Miercoles" styleClass="estiloletra" />
<p:selectBooleanCheckbox value="#{NivelesPersonaComponent.nivelespersona1.checaJueves}" />
<p:spacer width="10" />
<h:outputLabel value="Jueves" styleClass="estiloletra" />
<p:spacer width="10" />
<p:selectBooleanCheckbox value="#{NivelesPersonaComponent.nivelespersona1.checaViernes}" />
<p:spacer width="10" />
<h:outputLabel value="Viernes" styleClass="estiloletra" />
<br></br>
<br></br>
<p:selectBooleanCheckbox value="#{NivelesPersonaComponent.nivelespersona1.checaSabado}" />
<p:spacer width="10" />
<h:outputLabel value="Sabado" styleClass="estiloletra" />
<p:spacer width="10" />
<p:selectBooleanCheckbox value="#{NivelesPersonaComponent.nivelespersona1.checaDomingo}" />
<p:spacer width="10" />
<h:outputLabel value="Domingo" styleClass="estiloletra" />
<p:spacer width="10" />
<p:selectBooleanCheckbox value="#{NivelesPersonaComponent.nivelespersona1.checaFestivo}" />
<p:spacer width="10" />
<h:outputLabel value="Festivo" styleClass="estiloletra" />
<br></br>
<br></br>
<p:selectBooleanCheckbox />
<p:spacer width="10" />
<h:outputLabel value="Debe registrar E/S en Biometrico" styleClass="estiloletra" />
<br></br>
<br></br>
<p:commandButton styleClass="botonAsistencias" value="Cancelar" style="width: 100px;" oncomplete="PF('modalHorario').hide();">
</p:commandButton>
<p:spacer width="20" height="1" />
<p:commandButton styleClass="botonAsistencias" value="Guardar" style="width: 100px;">
<p:ajax event="click" listener="#{NivelesPersonaComponent.saveNivelesPersona(NivelesPersonaComponent.nivelespersona1)}" process="@this" oncomplete="PF('modalHorario').hide();" />
</p:commandButton>
</p:dialog>
and in that dialog I have a save button, which sends to call the following method
@Transactional
public String saveNivelesPersona(NivelesPersona nivelespersona1) {
System.out.println("ENTRO AL METODO DE GUARDADO0");
NivelesPersona nivelespersona2 = nivelesPersonaService.saveNivelesPersona2(nivelespersona1);
nivelesPersonaService.saveNivelesPersonaHorarios(nivelespersona2.getCveIdNivelPersona(), horarios);
nivelesPersonaService.saveNivelesPersonaPersona(nivelespersona2.getCveIdNivelPersona(), persona);
nivelesPersonaService.saveNivelesPersonaUnidadAdministrativa(nivelespersona2.getCveIdNivelPersona(), unidadadministrativa);
return "/jsf/bienvenido.xhtml";
}
and that error comes out in console and it is that the objects hour, person and unit come null, it is as if from my view did not pick up those values of my p dialog, and initialize them and setie them to my object personaspersona1, but still does not take them
//Metodo inicializa
@Transactional
public String newNivelesPersona() {
nivelespersona1 = new NivelesPersona();
horarios = new Horarios();
unidadadministrativa = new UnidadAdministrativa();
persona = new Persona();
nivelespersona1.setHorarios(horarios);
nivelespersona1.setUnidadAdministrativa(unidadadministrativa);
nivelespersona1.setPersona(persona);
//Se obtiene la unidad fisica de la sesion
unidadFisica = (Integer) getSession().getAttribute(Constantes.UNIDAD_FISICA);
//Se obtiene las personas que se encuentran en la misma unidad fisica
listNivelesPersona = nivelesPersonaService.findNivelesPersonaByUnidadAdmin(unidadFisica);
return RUTA;
}
The strange thing is that if I do not initialize those objects I do not get any errors, but if I move to my table the selection property that refers to my object of levelspersona1, which is the same object where I recover the values in my p dialog, if I change the name of that object in the table, I get the error that I must initialize the horraios, unidadadministrativa objects and I do it, but to show the p dialog no longer shows me loaded the info of that person unless you put the object personaspersona1 again to the selection property and I do not understand why What is failing and does not recover the value?