Pergunta

Im using an entity Employee and inside that a list of UserMaster is defined

public class EmployeeMaster{
    private String employee_id;
    private String first_name;
    private String last_name;
    private List<UserMaster> userMaster = new ArrayList<UserMaster>();

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "employeeMaster")
    @Cascade(value = {CascadeType.SAVE_UPDATE,CascadeType.DELETE_ORPHAN})   
    public  List<UserMaster> getUserMaster() {
        return userMaster;
    }
    public void setUserMaster(List<UserMaster> userMaster) {
        this.userMaster = userMaster;
    }
}

in my method im calling

xsession.saveOrUpdate(employeeMaster);

Here im clearing previous child collection explicitly and add new Child objects

But the delete orphan is not working here .. Only the insert query is running Pls Help

A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity

message is showing in the console

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top