I have a payment entity which have an accountInvoice
field
public class Payment implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JsonIgnoreProperties("payments")
@Cascade(value = { CascadeType.ALL })
private AccountInvoice accountInvoice;
}
When I try to save this payment entity with CascadeType.ALL
detached entity passed to persist
exception is being thrown but it works without any exception when CascadeType.MERGE
is used.If CascadeType.ALL
includes CascadeType.MERGE
why this behaviour?