[ZODB-Dev] Referential integrity

Steve Alexander steve@cat-box.net
Fri, 01 Mar 2002 11:31:22 +0000


Arnaud Bienvenu wrote:
> Hi,
> 
> I would like to know how ZODB deals with referential integrity (i.e. object
> A refers to object B, and I would A to be deleted if B is removed from a
> list).
> Will it be implemented ?
> Do you think referential integrity checks have to be part of ZODB or not ?
> What are today the best ways to set up these sort of integrity checks ?

I can think of three approaches:

1: Try to write your programs to respect referential integrity, and run 
Greg Ward's Oscar every night to catch problems.

2: Use Phillip Eby's TransWarp to weave into your clsases an Aspect that 
enforces referential integrity.

3: Sort out referential integrity at the application level with an Event 
Service that publishes object events, and make your data structures 
subscribe to such events (via intermediaries perhaps) and do the right 
kinds of things. You might want to use something like TransactionAgents 
as part of this approach, so that you queue up the effects of such rules 
of referential integrity and run all the rules at a transaction boundary.


--
Steve Alexander