I have the following class:
/**
To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package modelo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;
/**
*
* @author Daniel
*/
@Entity
public class Usuario implements Serializable
{
@Id
private String username;
@Lob
private byte[] fotoperfil;
private String nombre;
private String apellidos;
@ManyToOne (fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private Nivel nivel;
private String email;
private String password;
@ManyToMany (fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private final List<Usuario> amigos=new ArrayList();
@ManyToMany (fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private final List<Via> viasRealizadas=new ArrayList();
@ManyToMany (fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private final List<PeticionAmistad> peticionesAmistad=new ArrayList();
}
If I delete a User, I want to avoid cascading the relationship data. For example, if I delete a user, I want to avoid deleting the users included in the friends list.
How can you get it?