G
G
gibsonen2018-09-24 14:20:42
Java
gibsonen, 2018-09-24 14:20:42

Can't find the right cascade type?

Can anyone tell me what type of cascade to set?
In 1 entity field is:

@OneToMany(mappedBy = "client", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    private List<Ticket> tickets = new ArrayList<>();

In 2 is:
@ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "client_id")
    private Client client;

It is necessary that when deleting 2 entities (where manytoone) only it is deleted, and the object associated with it deletes only the connection. Already tried everything

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question