Erro ao alterar org.hibernate.NonUniqueObjectException

Estou realizando um update em um objeto e ocorre este erro abaixo :

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session

o meu código :

public String salvar(){
try {
if (!(this.idprojetopai == (long)0)) {
this.projeto.setProjetopai(new Projeto(this.idprojetopai));
} else {
this.projeto.getProjetopai().setIdprojeto(null);
}

        if (this.projeto.getIdprojeto() == (long)0) {
            gerente.save(this.projeto);
        } else {
            gerente.update(this.projeto);
        }
        msg.addSuccessMessage("PROJETO cadastrado com sucesso");
    } catch (Exception ex) {
        ex.printStackTrace();
        msg.addErrorMessage("Não foi possível atualizar o registro!");
    }
    
    if (projeto.getIdprojeto() ==(long)0){
        projeto = new Projeto();
    }
    
    return null;
}

[/b]

http://www.guj.com.br/posts/list/35969.java

olha a resposta do tralala para o negao (4° post)

Outras referencias:
http://www.google.com.br/search?q=NonUniqueObjectException

:wink: