JPA not generating “on delete set null” FK restrictions
I have two related clases JPA-annotated. Alarm and Status. One Alarm can have one Status. What I need is to be able to delete one Status and "propagate" a null value to the Alarms that are in that Status that has been deleted. That is, I need the foreign key to be defined as " on delete set null ". @Entity public class Alarm { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="sequence") @SequenceGenerator(name="sequence", sequenceName="alarm_pk_seq") private Integer id; @OneToOne(cascade=CascadeType.ALL) @JoinColumn(name="idStatus") private Status status; // get/set } @Entity