0
I created an update method, however I am having to create a variable to update my position property, which although it is working, I think this would not be the correct way to treat an object.
I have this property in the object Funciomodel follows below the code.
public void atualizar(FuncionarioModel funcionarioModel) throws NegocioException {
String cargo = funcionarioModel.getCargo();
funcionarioModel = this.funcionarioRepository.porId(funcionarioModel.getCodigo());
funcionarioModel.setCargo(cargo);
if (cargo.isEmpty()) {
throw new NegocioException("Não é possível fazer a Alteração campo cargo está vazio !");
}
}
if anyone knows how I can fix this.
can you be a little more explicit about what you want? I’m not sure if you want to rewrite that method or not....
– Vítor Sá
Thanks Vitor for the return, I wish I didn’t have to create exactly this line in the code String cargo = functionModel.getCargo(); as I am object oriented I thought I would just use = String cargo =functionModel.setCargo(post); and it would be enough there it does not update. that is, if I don’t create String post = functionModel.getCargo(); to store what comes in the form, it takes that line functionModel.setCargo(post); what is in the database is that it doesn’t update.
– JavaX_javaX