Using PostgreSQL, why doesn't Hibernate/JPA create cascade constraints?
I have an entity Bar : @OneToMany(cascade = CascadeType.ALL, mappedBy = "bar") private Set<Foo> fooSet; And an entity Foo : @ManyToOne(optional = false) @JoinColumn(name = "bar_id") private Bar bar; Hibernate creates the foreign key constraint on foo.bar -> bar.id but it doesnt specify ON DELETE CASCADE . Why not? And is there any ways to achieve it? Alternatively I can add the ON DELETE CASCADE manually in the DB (and disable DDL generation), is this a good practice? And also, do I have to modify my code in some way to let Hibernate know that related records are deleted automatically by the