db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: auto-XXX setting (PART II)
Date Thu, 11 Mar 2004 20:37:09 GMT
hi armin,

thanks for your detailed proposal.

Armin Waibel wrote:

> Hi all,
> 
> here my thoughts about how OJB (on PB-level) should manage the auto-XXX 
> settings. Does this make sense? Would you prefer a different behaviour?
> 
> ------------
> 1:1 relation
> ------------
> - auto-retieve false
> Referenced object was not materialized
> 
> - auto-retieve true
> Referenced object was materialized
> 
> - auto-update false
> Referenced object was not insert/update on store of main object. 
> Referenced object was not modified. User have to assign FK in main 
> object by hand (calling a PB service method to assign FK).
> 
> - auto-update true
> Referenced object insert/update too on store of main object. Automatic 
> assignment of FK in main object.
> 
> - auto-delete false
> Only main object will be deleted.
> 
> - auto-delete true
> Delete reference too when main object was deleted.
> 

i agree

> 
> ------------
> 1:n relation
> ------------
> - auto-retieve false
> Only then main object was materialized.
> 
> - auto-retieve true
> Referenced objects will be materialized too.
> 
> - auto-update false
> Only the main object will be insert/update, references will ignored. 
> User has to take care of referenced objects and have to assign FK by 
> hand (using a PB service method to assign FK)
> 
> - auto-update true
> On insert/update of the main object all n references will be handled 
> too. OJB does an automatic FK assignment on all references and do 
> insert/update references too. The FK fields will be set (again) on each 
> store of the main object.
> 
> - auto-delete false
> Only main object will be deleted. User has to take care of key 
> constraint violations, e.g. don't delete main object without nullify FK 
> in the referenced objects. Maybe we need a service method to nullify FK 
> fields in 1:n relations.
> 
> - auto-delete true
> Delete all associated references and the main object. User has to take 
> care that all n-side references are load on main object before delete 
> the main object. Means if object A has a 1:n reference with B and only 4 
> instead of all 5 B objects are associated with A (hold in reference 
> collection) OJB will cause an key constraint violation.
> 

i agree.

-auto-delete=true: related objects could eventually be deleted by 
pb.deleteByQuery to avoid loading of objects.

-auto-delete=false: nullify fk of related objects may be useful, but in most 
cases the related objects are childs and die with their parent.
> 
> ------------
> m:n relation
> ------------
> - auto-retieve false
> Only then main object was materialized.
> 
> - auto-retieve true
> Referenced objects will be materialized too.
> 
> - auto-update false
> Insert/update the main object only. User has to insert the references 
> and populate the indirection table by hand (using a service method to 
> write the indirection table entries)
> 
> - auto-update true
> Insert/update main object, insert/update all references, write 
> indirection table entries.

we have to avoid duplicate inserts in the indirection table on 
bidirectional-relationships. but this should imo already work.

> 
> - auto-delete false
> Delete entries in indirection table for given object and delete object 
> itself.
> 
> - auto-delete true
> Delete entries in indirection table for given object and delete object 
> itself and all referenced objects. (should be used very carefully ;-))
> 

i agree

jakob

> That's all folks!
> Armin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message