How does JPA orphanRemoval=true differ from the ON DELETE CASCADE DML clause

I am a little confused about the JPA 2.0 orphanRemoval attribute. I think I can see it is needed when I use my JPA provider’s DB generation tools to create the underlying database DDL to have an ON DELETE CASCADE on the particular relation. However, if the DB exists and it already has an ON … Read more

How to add “on delete cascade” constraints?

In PostgreSQL 8 is it possible to add ON DELETE CASCADES to the both foreign keys in the following table without dropping the latter? # \d scores Table “public.scores” Column | Type | Modifiers ———+———————–+———– id | character varying(32) | gid | integer | money | integer | not null quit | boolean | last_ip … Read more

On delete cascade with doctrine2

I’m trying to make a simple example in order to learn how to delete a row from a parent table and automatically delete the matching rows in the child table using Doctrine2. Here are the two entities I’m using: Child.php: <?php namespace Acme\CascadeBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name=”child”) */ class Child … Read more