This message I get when you perform the insert in the database and it does not give any errors, it only gives this message of warning .
Warning: The class RepeatableWriteUnitOfWork is already flushing. The query will be executed without further changes being written to the database. If the query is conditional upon changed data the changes may not be reflected in the results. Users should issue a flush () call upon completion of the dependent changes and prior to this flush () to ensure correct results.
NclDocumento documento = null;
try {
NclTipoDocumento tipo = findTipoDocumentoById(tipoD.getValue());
if (numero != null && numero != 0 && anioSelected != null) {
documento = findAcuerdoByNumeroAndAnioAndTipoDocumento(numero, anioSelected, tipo);
if (documento != null) {
return new Response<>(documento, ResponseStatus.OK_INSERT);
}
}
if (documento == null) {
documento = new NclDocumento();
documento.setNumero(122);
documento.setAnio(2014);
documento.setFechaEmision(new Date());
documento.setIdTipoDocumento(em.find(NclTipoDocumento.class,1));
if (firma != null && firma.getEmpleado() != null) {
documento.setIdFirma(firma.getEmpleado());
}
documento.setFechaCreacion(new Date());
documento.setUsuarioCreacion(usuarioLogueado);
documento.setActivo(true);
}
em.persist(documento);
em.flush();
return new Response<>(documento, ResponseStatus.OK_INSERT);
} catch (ConstraintViolationException ex) {
String validationError = getConstraintViolationExceptionAsString(ex);
log.error(validationError);
context.setRollbackOnly();
return new Response<>(ResponseStatus.ERROR_PARAMS, "Sucedio un error con la información: " + validationError);
} catch (Exception ex) {
processException(ex);
context.setRollbackOnly();
return new Response<>(ResponseStatus.ERROR, "Sucedio un error: " + ex.getMessage());
}