Foreign keys in Active Objects: On delete SET NULL?

Hi all,

We are working with Active Objects in Confluence Data Center (are we the last ones?). We have a foreign key between two records. Postgres, for example, has the following options:

  • ON DELETE RESTRICT: Throw an exception,
  • ON DELETE CASCADE: Delete the parent record too,
  • SET NULL: Set the value to null when the child is deleted,
  • SET DEFAULT.

ActiveObjects uses RESTRICT by default, which means it produces the following exception:

java.sql.SQLIntegrityConstraintViolationException:
integrity constraint violation:
foreign key no action; FK_AO_32F7CE_TABLE_COLUMN_ID table: AO_32F7CE_OTHERTABLE

Is there any way to tell ActiveObjects to set “null” when we delete the parent record, for example using a @OneToMany or @OneToOne annotation?

1 Like

Did you find a straightforward way? Annotating the entity or something like that?

1 Like