How to edit an entity that has another object in jsf?

0

Good afternoon people, I'm new to programming and I'm having problems with my project in jsf. I have a client class that has an address object, with @OneToOne relationship for the address. I am able to query my address within the edit method. What I'm not able to do is bring the data from my address and display on the client's registration page, where the client's data is loaded normally, but it does not carry the address.

ClientBean:

public String alterar() {
    try {
        this.cliNovo = null;
        this.cliNovo = fach.consultarCliente(this.cliente.getId());

        if(cliNovo.getEndereco().getId() != null) {
            cliNovo.getEndereco().getLogradouro();
            cliNovo.getEndereco().getNumero();
            cliNovo.getEndereco().getEstado();
            cliNovo.getEndereco().getBairro();
            cliNovo.getEndereco().getEstado();
        }
        fach.atualizarCliente(cliNovo);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return "/cadastrocli.xhtml?faces-redirect-true";
    //"cadastrocli";
}
    
asked by anonymous 25.11.2016 / 17:21

0 answers