if (JOptionPane.showConfirmDialog(ResponsableController.this, "Desea Guardar?", "Condena", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION){
if (policia == null){
Integer nro = Integer.valueOf(nroPlacaTextField.getText());
policia = (Policia) ec.createQuery("select p from Policia p where p.nroPlaca = :nro", Policia.class).setParameter("nro", nro).getSingleResult();
}
Responsable responsable = new Responsable();
responsable.setPolicia(policia);
responsable.setFechaEntrada(fechaDateChooser.getDate());
responsable.setHoraEntrada(Time.valueOf(horaEntradaField.getText()+ ":00"));
responsable.setHoraSalida(Time.valueOf(horaSalidaField.getText()+ ":00"));
String codigo = pabellonesComboBox.getSelectedItem().toString().split(" - ")[0];
Pabellon pabellon = (Pabellon) ec.createQuery("select p from Pabellon p where p.codigo = :codigo", Pabellon.class).setParameter("codigo", codigo).getSingleResult();
responsable.setPabellon(pabellon);
ec.persist(responsable, true);
listener.onPanelClose();
}