why deleteById follows a bidirectional approach?
I have 2 entities where one entity has a many-to-one relationship with the second entity
entity 1:
@Entity
@Table(name = "chilling_unit")
@Data
@NoArgsConstructor
public class ChillingUnitMonitoringDetailsDAO {
upisidom
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@Column(name="edge_controller_serial_number",nullable = false)
private String l3SerialNumber;
@Column(name = "product_type_name")
private String productType;
@ManyToOne(fetch = FetchType.EAGER, optional = false,cascade = javax.persistence.CascadeType.ALL
@JoinColumn(name = "location_id")
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
@EqualsAndHashCode.Exclude
private LocationDAO location;
}
and entity 2:
@Entity
@Table(name = "location")
@Data
@NoArgsConstructor
public class LocationDAO {
upisidom
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@Column(name = "location_id",unique = true)
private String locId;
}