You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Craig L Russell <Cr...@Sun.COM> on 2007/12/07 02:42:30 UTC

Delete consistency specification update

Here's the proposed specification update for the delete section of  
consistency. It's written to go into 15.3 where we also discuss  
consistency for updates, and I think it also needs to go in another  
section because the first part of it doesn't really belong in the  
Relational Mapping part of the spec.

<proposed>
Delete consistency

If an instance is deleted, then during flush, each relationship in  
which the instance is involved is updated for consistency. These  
changes are applied to the object model instances. If the  
relationship is marked as dependent, the related instance is deleted.  
If the relationship is not marked as dependent, the corresponding  
field in the related instance is updated to not refer to the instance  
being deleted. If the related field is a collection, then any  
referencing element is removed. If the related field is a map, then  
any referencing map entry is removed. If the related field is a  
reference, then it is set to null. If the related instances are not  
instantiated in memory, there is no requirement to instantiate them.  
Changes are applied to the second level cache upon commit.

The object model changes are synchronized to the database according  
to the declared mapping of the relationships to the database. If  
related instances are to be deleted, and there is a foreign key  
declared with a delete action of cascade delete, then the jdo  
implementation needs to do nothing to cause the delete of the related  
instance. Similarly, if there s a foreign key declared with a delete  
action of nullify, then the jdo implementation needs to do nothing to  
cause the column of the mapped relationship to be set to null. If  
there is a foreign key declared to be not nullable, and the  
requirement is to nullify the related field, then  
JDODataStoreException is thrown at flush.

</proposed>


Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!